qemu-options: Bail out on unsupported options instead of silently ignoring them

The dangling remainder of the -tdf option revealed a deficiency in our
option parsing: Options that have been declared, but are not supported
in the switch-case statement in vl.c and not handled in the OS-specifc
os_parse_cmd_args() functions are currently silently ignored. We should
rather tell the users that they specified something that we can not
handle, so let's print an error message and exit instead.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1525453270-23074-3-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Thomas Huth
2018-05-04 19:01:07 +02:00
committed by Paolo Bonzini
parent 281b95231d
commit 1217d6ca2b
4 changed files with 12 additions and 5 deletions

View File

@ -165,7 +165,7 @@ static bool os_parse_runas_uid_gid(const char *optarg)
* Parse OS specific command line options.
* return 0 if option handled, -1 otherwise
*/
void os_parse_cmd_args(int index, const char *optarg)
int os_parse_cmd_args(int index, const char *optarg)
{
switch (index) {
#ifdef CONFIG_SLIRP
@ -199,7 +199,11 @@ void os_parse_cmd_args(int index, const char *optarg)
fips_set_state(true);
break;
#endif
default:
return -1;
}
return 0;
}
static void change_process_uid(void)