From 679212836a881b53382ea6bd811f38e00705d50d Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 17 Jul 2008 11:59:13 +0000 Subject: - fix segfault in nameif with mactab file (by fixing and shrink config parser) function old new delta config_free_data - 37 +37 config_open 43 48 +5 pack_gzip 1658 1660 +2 nameif_main 527 525 -2 SynchronizeFile 629 623 -6 make_device 1184 1176 -8 config_close 31 18 -13 config_read 431 393 -38 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/5 up/down: 44/-67) Total: -23 bytes --- util-linux/mdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'util-linux/mdev.c') diff --git a/util-linux/mdev.c b/util-linux/mdev.c index c04410c0c..f83dd6adf 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c @@ -94,14 +94,14 @@ static void make_device(char *path, int delete) type = S_IFBLK; if (ENABLE_FEATURE_MDEV_CONF) { - parser_t parser; + parser_t *parser = config_open("/etc/mdev.conf"); char *tokens[5]; /* If we have config file, look up user settings */ - if (!config_open(&parser, "/etc/mdev.conf")) + if (!parser) goto end_parse; - while (config_read(&parser, tokens, 4, 3, " \t", '#') >= 0) { + while (config_read(parser, tokens, 4, 3, " \t", '#') >= 0) { regmatch_t off[1+9*ENABLE_FEATURE_MDEV_RENAME_REGEXP]; char *val; @@ -213,7 +213,7 @@ static void make_device(char *path, int delete) const char *s2 = strchr(s, *val); if (!s2) - bb_error_msg_and_die("bad line %u", parser.lineno); + bb_error_msg_and_die("bad line %u", parser->lineno); /* Correlate the position in the "@$*" with the delete * step so that we get the proper behavior: @@ -229,7 +229,7 @@ static void make_device(char *path, int delete) break; /* we found matching line, stop */ } /* end of "while line is read from /etc/mdev.conf" */ - config_close(&parser); + config_close(parser); } end_parse: -- cgit v1.2.3