diff options
author | Elliott Hughes <enh@google.com> | 2021-05-14 09:07:07 -0700 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-05-15 12:38:10 -0500 |
commit | 267a1a572d8780c11b63fb8640e4c3752ce7f1a1 (patch) | |
tree | fc9fa23f8fa4a23c7750993ca9ce93a727c54e5b /toys/pending | |
parent | 2a8e198104e605b44d8955b6e247d579e098d776 (diff) | |
download | toybox-267a1a572d8780c11b63fb8640e4c3752ce7f1a1.tar.gz |
modprobe: don't stop on empty lines.
I don't _think_ that can happen with the .dep files since they're
machine-generated, but the config files can and do contain empty lines
to aid readability.
(Not found on Android, so I haven't tested this, but the code already
even contained a special case for empty lines. I haven't touched the
/proc/modules loop because the kernel definitely isn't going to insert
empty lines, and that code _would_ need to be modified to cope with
empty lines, and since I can't test this, that would be not just
pointless but also irresponsible!)
Diffstat (limited to 'toys/pending')
-rw-r--r-- | toys/pending/modprobe.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c index 7424e7c0..f1c4338e 100644 --- a/toys/pending/modprobe.c +++ b/toys/pending/modprobe.c @@ -224,7 +224,7 @@ static int config_action(struct dirtree *node) free(filename); return 0; } - for (line = linecp = NULL; read_line(fc, &line) > 0; + for (line = linecp = NULL; read_line(fc, &line) >= 0; free(line), free(linecp), line = linecp = NULL) { char *tk = NULL; @@ -286,7 +286,7 @@ static int depmode_read_entry(char *cmdname) int ret = -1; FILE *fe = xfopen("modules.dep", "r"); - while (read_line(fe, &line) > 0) { + while (read_line(fe, &line) >= 0) { char *tmp = strchr(line, ':'); if (tmp) { @@ -314,7 +314,7 @@ static void find_dep(void) struct module_s *mod; FILE *fe = xfopen("modules.dep", "r"); - for (; read_line(fe, &line) > 0; free(line)) { + for (; read_line(fe, &line) >= 0; free(line)) { char *tmp = strchr(line, ':'); if (tmp) { |