The following commit has been merged in the next branch: commit b320bf27babb12833777c8cc5e112c6ff18d42c4 Author: Simon Wunderlich simon.wunderlich@s2003.tu-chemnitz.de Date: Sun Jan 22 19:31:03 2012 +0100
batctl: exit on parse error in batctl ll
If the argument could not be understood, we should not try to apply something, but return from the function.
Signed-off-by: Simon Wunderlich siwu@hrz.tu-chemnitz.de
diff --git a/sys.c b/sys.c index 105bb51..27f144a 100644 --- a/sys.c +++ b/sys.c @@ -187,7 +187,7 @@ static void log_level_usage(void)
int handle_loglevel(char *mesh_iface, int argc, char **argv) { - int optchar, res; + int optchar, res = EXIT_FAILURE; int log_level = 0; char *path_buff; char str[4]; @@ -221,8 +221,10 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv) log_level |= (1 << 1); else if (strcmp(argv[i], "tt") == 0) log_level |= (1 << 2); - else + else { log_level_usage(); + goto out; + } }
snprintf(str, sizeof(str), "%i", log_level);