On Wed, Mar 21, 2018 at 11:28 AM, Rob Landley <r...@landley.net> wrote:
> On 03/16/2018 01:35 PM, enh wrote:
>> -    } else if (!(p = strafter(toybuf, vmstuff[i]))) goto error;
>> -    if (1 != sscanf(p, "%"PRIu64"%n", new++, &j)) goto error;
>> +    } else if (!(p = strafter(file, vmstuff[i]))) {
>> +      error_exit("No %sin %s", vmstuff[i], name);
>> +    }
>> +    if (1 != sscanf(p, "%"PRIu64"%n", new++, &j)) {
>> +      error_exit("Bad %sin %s: %s", vmstuff[i], name, p);
>> +    }
>>      p += j;
>>    }
>> -
>> -  return;
>> -
>> -error:
>> -  error_exit("No %sin %s\n", vmstuff[i], name);
>> +  free(file);
> Is the difference between a successfully opened /proc file not having an
> expected field and having no parseable data after the field identifier really
> significant enough to require two distinct error messages?

i try to never reuse an error message for multiple distinct failures,
just as SOP. it's the usual argument about throwing away the safety
gear before setting out to sea. sure, you _shouldn't_ need it, but...

especially given that i usually have no physical access to failing
devices, and will often only see statistical failure data, knowing
exactly which operation failed can be my only clue. (plus it was
necessary in order to debug this bug.)

> Both boil down to "Your kernel is broken, something is _really_ wrong."

and given enough devices, this is a daily occurrence. as are single
bit errors in both RAM and flash.

> Also, "vmstat -n" is never showing the header, rather than showing it once. Is
> this a bug or behavior somebody wanted?

sounds like a bug to me.

> Rob
Toybox mailing list

Reply via email to