diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-16 23:04:49 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-16 23:04:49 +0000 |
| commit | fb1642f2caa3690cb40f603fca22eeace09a0bfa (patch) | |
| tree | 0ae2f20765b93696322e8c6c5e928b0b1be2cbee | |
| parent | c01340fe26b76e172805ff641ad9af6bc45cdc91 (diff) | |
| download | busybox-w32-fb1642f2caa3690cb40f603fca22eeace09a0bfa.tar.gz busybox-w32-fb1642f2caa3690cb40f603fca22eeace09a0bfa.tar.bz2 busybox-w32-fb1642f2caa3690cb40f603fca22eeace09a0bfa.zip | |
fix up callsites of config_read to check for >= 0
| -rw-r--r-- | libbb/parse_config.c | 4 | ||||
| -rw-r--r-- | miscutils/crond.c | 2 | ||||
| -rw-r--r-- | networking/nameif.c | 2 | ||||
| -rw-r--r-- | util-linux/mdev.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/libbb/parse_config.c b/libbb/parse_config.c index e63204b09..f07099285 100644 --- a/libbb/parse_config.c +++ b/libbb/parse_config.c | |||
| @@ -19,7 +19,7 @@ Typical usage: | |||
| 19 | // open file | 19 | // open file |
| 20 | if (config_open(filename, &p)) { | 20 | if (config_open(filename, &p)) { |
| 21 | // parse line-by-line | 21 | // parse line-by-line |
| 22 | while (*config_read(&p, t, 3, 0, delimiters, comment_char)) { // 0..3 tokens | 22 | while (*config_read(&p, t, 3, 0, delimiters, comment_char) >= 0) { // 0..3 tokens |
| 23 | // use tokens | 23 | // use tokens |
| 24 | bb_error_msg("TOKENS: [%s][%s][%s]", t[0], t[1], t[2]); | 24 | bb_error_msg("TOKENS: [%s][%s][%s]", t[0], t[1], t[2]); |
| 25 | } | 25 | } |
| @@ -77,7 +77,7 @@ int FAST_FUNC config_read(parser_t *parser, char **tokens, int ntokens, int mint | |||
| 77 | //TODO: speed up xmalloc_fgetline by internally using fgets, not fgetc | 77 | //TODO: speed up xmalloc_fgetline by internally using fgets, not fgetc |
| 78 | line = xmalloc_fgetline(parser->fp); | 78 | line = xmalloc_fgetline(parser->fp); |
| 79 | if (!line) | 79 | if (!line) |
| 80 | return line; | 80 | return -1; |
| 81 | 81 | ||
| 82 | parser->lineno++; | 82 | parser->lineno++; |
| 83 | // handle continuations. Tito's code stolen :) | 83 | // handle continuations. Tito's code stolen :) |
diff --git a/miscutils/crond.c b/miscutils/crond.c index af37bb15b..41f151753 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
| @@ -468,7 +468,7 @@ static void SynchronizeFile(const char *fileName) | |||
| 468 | file->cf_User = xstrdup(fileName); | 468 | file->cf_User = xstrdup(fileName); |
| 469 | pline = &file->cf_LineBase; | 469 | pline = &file->cf_LineBase; |
| 470 | 470 | ||
| 471 | while (--maxLines && (n=config_read(&parser, tokens, 6, 0, " \t", '#')) > 0) { | 471 | while (--maxLines && (n=config_read(&parser, tokens, 6, 0, " \t", '#')) >= 0) { |
| 472 | CronLine *line; | 472 | CronLine *line; |
| 473 | 473 | ||
| 474 | if (DebugOpt) { | 474 | if (DebugOpt) { |
diff --git a/networking/nameif.c b/networking/nameif.c index 506f4fa1c..c5a715e36 100644 --- a/networking/nameif.c +++ b/networking/nameif.c | |||
| @@ -163,7 +163,7 @@ int nameif_main(int argc, char **argv) | |||
| 163 | struct parser_t parser; | 163 | struct parser_t parser; |
| 164 | if (config_open(&parser, fname)) { | 164 | if (config_open(&parser, fname)) { |
| 165 | char *tokens[2]; | 165 | char *tokens[2]; |
| 166 | while (config_read(&parser, tokens, 2, 2, " \t", '#')) | 166 | while (config_read(&parser, tokens, 2, 2, " \t", '#') >= 0) |
| 167 | prepend_new_eth_table(&clist, tokens[0], tokens[1]); | 167 | prepend_new_eth_table(&clist, tokens[0], tokens[1]); |
| 168 | config_close(&parser); | 168 | config_close(&parser); |
| 169 | } | 169 | } |
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index 8968e45f8..c04410c0c 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
| @@ -101,7 +101,7 @@ static void make_device(char *path, int delete) | |||
| 101 | if (!config_open(&parser, "/etc/mdev.conf")) | 101 | if (!config_open(&parser, "/etc/mdev.conf")) |
| 102 | goto end_parse; | 102 | goto end_parse; |
| 103 | 103 | ||
| 104 | while (config_read(&parser, tokens, 4, 3, " \t", '#')) { | 104 | while (config_read(&parser, tokens, 4, 3, " \t", '#') >= 0) { |
| 105 | regmatch_t off[1+9*ENABLE_FEATURE_MDEV_RENAME_REGEXP]; | 105 | regmatch_t off[1+9*ENABLE_FEATURE_MDEV_RENAME_REGEXP]; |
| 106 | char *val; | 106 | char *val; |
| 107 | 107 | ||
