This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] nftw: fill in stat buf for dangling links [BZ #23501]


On Jun 21 2019, DJ Delorie <dj@redhat.com> wrote:

> Tulio Magno Quites Machado Filho <tuliom@ascii.art.br> writes:
>>> +	  if (err < 0)
>>> +	    {
>>> +	      /* Stat failed.  We have three choices: don't report
>>> +		 this file, report with invalid data, or report with
>>> +		 zero'd data.  Let's prefer obvious over subtle so
>>> +		 zero the data here.  This should happen extremely
>>> +		 rarely.  */
>>> +	      memset (&st, 0, sizeof (st));
>>> +	    }
>>
>> I could not find a description of this behavior in the standard.
>
> The spec doesn't cover it, so I defined it that way.  The only
> alternative is to leave the buffer unchanged, which most likely would
> report seemingly correct but invalid results.
>
> The only time this happens is if we can know that a symlink exists in a
> directory, but cannot read its stats.  I expect this to be exceedingly
> rare.

If it's ENOENT, you could just skip it.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]