Re: [hackers] [sbase][patch] find: empty line means no for -ok

From: Evan Gates <evan.gates_AT_gmail.com>
Date: Thu, 18 Jun 2015 18:01:42 -0700

On Thu, Jun 18, 2015 at 3:57 PM, Wolfgang Corcoran-Mathe
<first.lord.of.teal_AT_gmail.com> wrote:
> emg,
>
> Quoth Evan Gates on Thu, Jun 18 2015 14:47 -0700:
>>
>> diff --git a/find.c b/find.c
>> index 186263b..0de1951 100644
>> --- a/find.c
>> +++ b/find.c
>> _AT_@ -415,10 +415,9 @@ pri_ok(struct arg *arg)
>> reply = fgetc(stdin);
>>
>> /* throw away rest of line */
>> - while ((c = fgetc(stdin)) != '\n' && c != EOF)
>> - /* FIXME: what if the first character of the rest of the
>> line is a null
>> - * byte? */
>> - ;
>> + if (c != '\n')
>> + while ((c = fgetc(stdin)) != '\n' && c != EOF)
>> + ;
>
>
> I think you meant
>
> if (reply != '\n')
> ...

Yes I most certainly did, this is what I get for submitting patches
without testing. The shame. New patch attached, also protects against
the glibc bug causing fgetc to hang after EOF was received.
-emg

Received on Fri Jun 19 2015 - 03:01:42 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 19 2015 - 03:12:10 CEST