[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Findutils-patches] [PATCH] find: handle more readdir(3) errors
From: |
Eric Blake |
Subject: |
Re: [Findutils-patches] [PATCH] find: handle more readdir(3) errors |
Date: |
Tue, 1 Nov 2016 16:45:55 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 11/01/2016 04:32 PM, Bernhard Voelker wrote:
>
>> However,
>
>>> +++ b/lib/fdleak.c
>
>>> - while ((dent=readdir (dir)) != NULL) - { + while (1) +
>>> { + errno = 0;
>
> __________^^^^^^^^^^
Uggh. Mail clients botched the formatting.
>
>>> + dent = readdir (dir);
>
>
> errno _is_ initialized right before each readdir() call, see above,
> so I don't see the problem here.
Whoops - blame a late-day review on my part.
You're right - the first file did readdir() inside the for loop; the
second does readdir() inside a while(1) loop. Okay, I stand corrected,
the second file is indeed fine (because it DOES reset errno each time);
but you are right that adding a comment to the first file will help.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature