Mail Archives: djgpp-workers/2003/03/19/13:32:13
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/ ]
- Raw text -