mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-03-09 15:14:01 +07:00
coredumpctl: add guard to options table
It is not nice to segfault on unknown options :(
This commit is contained in:
parent
50425d1614
commit
57ce4bd4ea
@ -143,10 +143,11 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
int r, c;
|
||||
|
||||
static const struct option options[] = {
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version" , no_argument, NULL, ARG_VERSION },
|
||||
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
|
||||
{ "output", required_argument, NULL, 'o' },
|
||||
{ "help", no_argument, NULL, 'h' },
|
||||
{ "version" , no_argument, NULL, ARG_VERSION },
|
||||
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
|
||||
{ "output", required_argument, NULL, 'o' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
assert(argc >= 0);
|
||||
@ -183,6 +184,10 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case '?':
|
||||
return -EINVAL;
|
||||
|
||||
default:
|
||||
log_error("Unknown option code %c", c);
|
||||
return -EINVAL;
|
||||
|
Loading…
Reference in New Issue
Block a user