diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-07-17 11:59:13 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2008-07-17 11:59:13 +0000 |
commit | 679212836a881b53382ea6bd811f38e00705d50d (patch) | |
tree | e5c349683a57c55b650eae77b1ca5ac40c94a175 /util-linux/mdev.c | |
parent | 0f683f818cf087d580ba2edf7c096897bc28b95a (diff) | |
download | busybox-w32-679212836a881b53382ea6bd811f38e00705d50d.tar.gz busybox-w32-679212836a881b53382ea6bd811f38e00705d50d.tar.bz2 busybox-w32-679212836a881b53382ea6bd811f38e00705d50d.zip |
- 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
Diffstat (limited to 'util-linux/mdev.c')
-rw-r--r-- | util-linux/mdev.c | 10 |
1 files changed, 5 insertions, 5 deletions
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) | |||
94 | type = S_IFBLK; | 94 | type = S_IFBLK; |
95 | 95 | ||
96 | if (ENABLE_FEATURE_MDEV_CONF) { | 96 | if (ENABLE_FEATURE_MDEV_CONF) { |
97 | parser_t parser; | 97 | parser_t *parser = config_open("/etc/mdev.conf"); |
98 | char *tokens[5]; | 98 | char *tokens[5]; |
99 | 99 | ||
100 | /* If we have config file, look up user settings */ | 100 | /* If we have config file, look up user settings */ |
101 | if (!config_open(&parser, "/etc/mdev.conf")) | 101 | if (!parser) |
102 | goto end_parse; | 102 | goto end_parse; |
103 | 103 | ||
104 | while (config_read(&parser, tokens, 4, 3, " \t", '#') >= 0) { | 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 | ||
@@ -213,7 +213,7 @@ static void make_device(char *path, int delete) | |||
213 | const char *s2 = strchr(s, *val); | 213 | const char *s2 = strchr(s, *val); |
214 | 214 | ||
215 | if (!s2) | 215 | if (!s2) |
216 | bb_error_msg_and_die("bad line %u", parser.lineno); | 216 | bb_error_msg_and_die("bad line %u", parser->lineno); |
217 | 217 | ||
218 | /* Correlate the position in the "@$*" with the delete | 218 | /* Correlate the position in the "@$*" with the delete |
219 | * step so that we get the proper behavior: | 219 | * step so that we get the proper behavior: |
@@ -229,7 +229,7 @@ static void make_device(char *path, int delete) | |||
229 | break; /* we found matching line, stop */ | 229 | break; /* we found matching line, stop */ |
230 | } /* end of "while line is read from /etc/mdev.conf" */ | 230 | } /* end of "while line is read from /etc/mdev.conf" */ |
231 | 231 | ||
232 | config_close(&parser); | 232 | config_close(parser); |
233 | } | 233 | } |
234 | end_parse: | 234 | end_parse: |
235 | 235 | ||