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
diff --git a/src/hlr_db_tool.c b/src/hlr_db_tool.c
index fb10f3e..d8a3584 100644
--- a/src/hlr_db_tool.c
+++ b/src/hlr_db_tool.c
@@ -159,6 +159,12 @@
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)