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]


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.


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