diff options
author | Bernhard Reutner-Fischer | 2008-07-17 11:59:13 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer | 2008-07-17 11:59:13 +0000 |
commit | 679212836a881b53382ea6bd811f38e00705d50d (patch) | |
tree | e5c349683a57c55b650eae77b1ca5ac40c94a175 /miscutils/crond.c | |
parent | 0f683f818cf087d580ba2edf7c096897bc28b95a (diff) | |
download | busybox-679212836a881b53382ea6bd811f38e00705d50d.zip busybox-679212836a881b53382ea6bd811f38e00705d50d.tar.gz |
- 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 'miscutils/crond.c')
-rw-r--r-- | miscutils/crond.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c index 41f1517..d8423cf 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c @@ -443,7 +443,7 @@ static void FixDayDow(CronLine *line) static void SynchronizeFile(const char *fileName) { - struct parser_t parser; + struct parser_t *parser; struct stat sbuf; int maxLines; char *tokens[6]; @@ -455,12 +455,13 @@ static void SynchronizeFile(const char *fileName) return; DeleteFile(fileName); - if (!config_open(&parser, fileName)) + parser = config_open(fileName); + if (!parser) return; maxLines = (strcmp(fileName, "root") == 0) ? 65535 : MAXLINES; - if (fstat(fileno(parser.fp), &sbuf) == 0 && sbuf.st_uid == DaemonUid) { + if (fstat(fileno(parser->fp), &sbuf) == 0 && sbuf.st_uid == DaemonUid) { CronFile *file = xzalloc(sizeof(CronFile)); CronLine **pline; int n; @@ -468,11 +469,11 @@ static void SynchronizeFile(const char *fileName) file->cf_User = xstrdup(fileName); pline = &file->cf_LineBase; - while (--maxLines && (n=config_read(&parser, tokens, 6, 0, " \t", '#')) >= 0) { + while (--maxLines && (n=config_read(parser, tokens, 6, 0, " \t", '#')) >= 0) { CronLine *line; if (DebugOpt) { - crondlog(LVL5 "user:%s entry:%s", fileName, parser.data); + crondlog(LVL5 "user:%s entry:%s", fileName, parser->data); } /* check if line is setting MAILTO= */ @@ -519,7 +520,7 @@ static void SynchronizeFile(const char *fileName) crondlog(WARN9 "user %s: too many lines", fileName); } } - config_close(&parser); + config_close(parser); } static void CheckUpdates(void) |