kernel-install: silently ignore unexpected arguments for 'remove' command
The shell script version of kernel-install silently ignored unexpected arguments, but C version refused that. Unfortunately, Fedora's kernel script specifies kernel file even for 'remove' command. Let's accept extra arguments and silently ignore them to keep backward compatibility. Fixes #28448. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2223794.
This commit is contained in:
committed by
Daan De Meyer
parent
e30c6e913c
commit
149aedb89b
@@ -1041,9 +1041,13 @@ static int verb_remove(int argc, char *argv[], void *userdata) {
|
||||
Context *c = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
|
||||
assert(argc == 2);
|
||||
assert(argc >= 2);
|
||||
assert(argv);
|
||||
|
||||
if (argc > 2)
|
||||
log_debug("Too many arguments specified. 'kernel-install remove' takes only kernel version. "
|
||||
"Ignoring residual arguments.");
|
||||
|
||||
c->action = ACTION_REMOVE;
|
||||
|
||||
r = context_set_version(c, argv[1]);
|
||||
@@ -1220,7 +1224,7 @@ static int parse_argv(int argc, char *argv[], Context *c) {
|
||||
static int run(int argc, char* argv[]) {
|
||||
static const Verb verbs[] = {
|
||||
{ "add", 3, VERB_ANY, 0, verb_add },
|
||||
{ "remove", 2, 2, 0, verb_remove },
|
||||
{ "remove", 2, VERB_ANY, 0, verb_remove },
|
||||
{ "inspect", 1, 2, VERB_DEFAULT, verb_inspect },
|
||||
{}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user