Problem with stat

Eric Blake ebb9@byu.net
Tue Jun 26 13:06:00 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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             ebb9@byu.net
-----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

iD8DBQFGgQ+q84KuGfSFAYARAm+kAJ0bARWTH57n9ggp63sJdWJ+dcl1WQCfW3ri
5NClwMnfEd6IO9RfSl6vtws=
=x6gp
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list