Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3E78AC79.D615F93B@phekda.freeserve.co.uk> Date: Wed, 19 Mar 2003 17:44:25 +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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Eli Zaretskii wrote: [snip] > Fine with me, but I have one question. In the following snippet from > fstat: > > > + /* See if this is a file descriptor for a directory. If so, just > > + * use a normal stat call. */ > > + if (__get_fd_flags(handle) & FILE_DESC_DIRECTORY) > > + { > > + const char *filename = __get_fd_name(handle); > > + > > + if (filename) > > + return stat(filename, statbuf); > > should we call `stat' or `lstat'? lstat returns statistics about the file or symbolic link named. stat will return statistics about the file or follow a symbolic link and return statistics about the target file. So, since 'handle' refers to a directory, we know it's not a symbolic link. So we can just stat it. 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. So I think stat is OK. Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]