db-tool: error-exit on too many arguments
Each arg parsing should increment optind, so if there are any surplus args in the end, that's an error. Change-Id: I9fc0a87d11db8c35061568e3f8b5a5547931a961
This commit is contained in:
parent
c82e6ad190
commit
8db490695d
|
@ -159,6 +159,12 @@ static void handle_options(int argc, char **argv)
|
|||
print_help();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (argc - optind > 0) {
|
||||
fprintf(stderr, "Too many arguments: '%s'\n", argv[optind]);
|
||||
print_help();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
static void signal_hdlr(int signal)
|
||||
|
|
Loading…
Reference in New Issue