Re: [Toybox] [PATCH] modprobe: fix parsing of short lines.

2021-06-04 Thread Yi-yo Chiang via Toybox
I wonder, would it make cleaner and shorter code here, if we just unfold the `for (strtok(...) ...)` loop two times and check that both calls succeed. On Fri, Jun 4, 2021 at 6:20 AM enh via Toybox wrote: > The intent here seems to have been to ignore lines with too few > arguments to be valid, b

[Toybox] [PATCH] modprobe: fix parsing of short lines.

2021-06-03 Thread enh via Toybox
The intent here seems to have been to ignore lines with too few arguments to be valid, but since strtok() returns NULL at the end of the string, if you only have "verb noun", you'd be falsely rejected. Since we've kept a count anyway, just check the count. --- toys/pending/modprobe.c | 3 ++- 1 f