delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/26/09:06:22

X-Spam-Check-By: sourceware.org
Message-ID: <46810FAA.5050508@byu.net>
Date: Tue, 26 Jun 2007 07:07:54 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.12) Gecko/20070509 Thunderbird/1.5.0.12 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com, oceanare AT pacific DOT net DOT sg
Subject: Re: Problem with stat
References: <46808EA8 DOT 2030202 AT pacific DOT net DOT sg> <4680DD73 DOT 8090300 AT sh DOT cvut DOT cz> <4680E3A0 DOT 3020508 AT pacific DOT net DOT sg> <4680FE40 DOT 7010102 AT byu DOT net> <46810D24 DOT 9000303 AT pacific DOT net DOT sg>
In-Reply-To: <46810D24.9000303@pacific.net.sg>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----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 AT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019