This is the mail archive of the
mailing list for the Cygwin project.
Re: Problem with stat
-----BEGIN PGP SIGNED MESSAGE-----
According to Erich Dollansky on 6/26/2007 6:57 AM:
> if (stat ("/usr/X11R6/share/doc/lesstif-0.94.4/html/Lessdox", &Stat)
> == 0)
> printf ("Mode: %lX\n", (unsigned long) Stat.st_mode);
> if (S_ISDIR (Stat.st_mode))
> printf ("Directory flag is set.\n");
> The result is the same as before.
> I do not get the message 'Link flag is set.'
And that is correct behavior. It is a bug if you can ever make stat() or
fstat() report S_ISLNK. Only lstat() can do that (well, fstatat can also
do it, once it is implemented).
> Why is Lessdox not recognised as a link here?
Because your program asked about what the link pointed to, and not about
the link itself. The command line 'stat' uses lstat(), which is probably
what you want your program to do. And this question is not cygwin-specific.
Don't work too hard, make some time for fun as well!
Eric Blake firstname.lastname@example.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html