Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3E78DB55.6A8E9C59@phekda.freeserve.co.uk> Date: Wed, 19 Mar 2003 21:04:21 +0000 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: DJGPP workers Subject: Re: fchdir, revision 2 [PATCH] References: <7458-Wed19Mar2003174724+0200-eliz AT elta DOT co DOT il> <3E78AC79 DOT D615F93B AT phekda DOT freeserve DOT co DOT uk> <7458-Wed19Mar2003223447+0200-eliz AT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Eli Zaretskii wrote: > > > Date: Wed, 19 Mar 2003 17:44:25 +0000 > > From: Richard Dawe > > > > Ah, I see, you're thinking that 'filename' might contain symbolic > > links in its path, thereby requiring an lstat() instead. I don't > > think that 'filename' will contain any symbolic links. The filename > > from fd_props should have no symbolic links in it, because open() > > solves all symlinks, before storing the filename in fd_props. > > The question is, what does `fstat' do on Unix for file handles opened > on symbolic links: does it return info about the link or about its > target? According to POSIX: You can't get a file descriptor for a symlink using open(). For a symlink, open() should follow the symlink. We have the additional options: * O_NOFOLLOW, which causes open() to fail, if the file is a symlink. * O_NOLINK, which causes open() to actually open the symlink as a normal file. If you've used O_NOLINK, I think it's reasonable to return info about the symlink. (I think this behaviour is OK.) I suppose you could get a handle to a symlink using _open(). But in that case the file descriptor was created outside the normal POSIX I/O functions. I think it's reasonable to treat the "symlink" as a normal file in that case. This is analogous to open(..., O_NOLINK|...), I guess. Bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]