diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2013-07-23 10:28:42 +0200 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-07-23 12:24:31 +0200 |
commit | b5f942d6392b9721b686ec504134e88e55e61cb0 (patch) | |
tree | fdde9a218cc9c3d660318228250c29321f59f5f4 | |
parent | 600a9c0d2b74b113fe032ff15e77f0bd4790125b (diff) | |
download | unitd-b5f942d6392b9721b686ec504134e88e55e61cb0.tar unitd-b5f942d6392b9721b686ec504134e88e55e61cb0.zip |
Parse only init_debug option with non-empty argument.
Matching empty string makes rm_so and rm_eo of struct regmatch_t have
the same value, in this case both of them are 11. This causes a call to
atoi("\0") whose return value 0 is just the initial value of 'debug'.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
-rw-r--r-- | debug.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -36,7 +36,7 @@ void debug_init(void) line[r] = '\0'; close(fd); - regcomp(&pat_cmdline, "init_debug=([0-9]*)", REG_EXTENDED); + regcomp(&pat_cmdline, "init_debug=([0-9]+)", REG_EXTENDED); if (!regexec(&pat_cmdline, line, 2, matches, 0)) { line[matches[1].rm_eo] = '\0'; debug = atoi(&line[matches[1].rm_so]); |