Skip to content

Commit

Permalink
Fail on superfluous command line arguments
Browse files Browse the repository at this point in the history
cgzones committed Apr 20, 2024
1 parent cda8ad3 commit d658cd6
Showing 5 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/arpobserver-checkd.c
Original file line number Diff line number Diff line change
@@ -550,6 +550,11 @@ int main(int argc, char *argv[])
}
}

if (optind < argc) {
usage();
return EXIT_FAILURE;
}

log_open(CHECK_ARGV0);
log_mode(lmode);
if (verbose)
5 changes: 5 additions & 0 deletions src/arpobserver-dumpstate.c
Original file line number Diff line number Diff line change
@@ -81,6 +81,11 @@ int main(int argc, char *argv[])
}
}

if (optind < argc) {
usage();
return EXIT_FAILURE;
}

log_open(DUMP_ARGV0);
if (verbose)
log_max_priority(LOG_DEBUG);
5 changes: 5 additions & 0 deletions src/arpobserver-mysql.c
Original file line number Diff line number Diff line change
@@ -384,6 +384,11 @@ int main(int argc, char *argv[])
}
}

if (optind < argc) {
usage();
return EXIT_FAILURE;
}

log_open(MYSQL_ARGV0);
if (verbose)
log_max_priority(LOG_DEBUG);
5 changes: 5 additions & 0 deletions src/arpobserver-stdout.c
Original file line number Diff line number Diff line change
@@ -82,6 +82,11 @@ int main(int argc, char *argv[])
}
}

if (optind < argc) {
usage();
return EXIT_FAILURE;
}

log_open("arpobserver-syslog");
log_mode(LOG_MODE_STDOUT);
if (verbose)
5 changes: 5 additions & 0 deletions src/arpobserver-syslog.c
Original file line number Diff line number Diff line change
@@ -84,6 +84,11 @@ int main(int argc, char *argv[])
}
}

if (optind < argc) {
usage();
return EXIT_FAILURE;
}

log_open("arpobserver-syslog");
log_mode(LOG_MODE_SYSLOG);
if (verbose)

0 comments on commit d658cd6

Please sign in to comment.