[Toybox] [PATCH] modprobe: fix parsing of short lines.
Yi-yo Chiang
yochiang at google.com
Fri Jun 4 00:25:32 PDT 2021
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 <toybox at lists.landley.net>
wrote:
> 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 file changed, 2 insertions(+), 1 deletion(-)
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
--
Yi-yo Chiang
Software Engineer
yochiang at google.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210604/6aafddd1/attachment.htm>
More information about the Toybox
mailing list