bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug w/ gawk stat extension


From: Andrew J. Schorr
Subject: Re: Bug w/ gawk stat extension
Date: Wed, 22 Jun 2005 14:58:02 -0400
User-agent: Mutt/1.4.1i

On Wed, Jun 22, 2005 at 08:45:28PM +0200, Jim Meyering wrote:
> IMHO, the best way to read a link name is to call readlink in a loop.
> If you roll your own, beware that st_size is sometimes not at all
> related to the length of the link name.

Hmmm, is that true?  According to the Single Unix Spec at

   http://www.opengroup.org/onlinepubs/009695399/functions/lstat.html

"The value returned in the st_size member is the length of the contents of
the symbolic link, and does not count any trailing null."

Are there platforms where this does not hold?  Does Windoze behave
differently?  Are there unix-type platforms where st_size is not
the link length?

In any case, the worst-case failure mode is that the linkval field is simply
not present in the array returned by the stat function, so I'm not
sure it's worth going crazy over this...

Regards,
Andy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]