diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2016-02-12 17:02:25 -0200 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineering.com> | 2019-11-29 19:45:30 -0600 |
commit | 2cd7691fa5ec87e0da711de3e2ff28a9abe8bb27 (patch) | |
tree | 0ea5a2260a46c634ed09f640abf488d0106e179e | |
parent | 500cd054ae34b2c5a02edb244a49e4a0c982ed73 (diff) | |
download | hqemu-2cd7691fa5ec87e0da711de3e2ff28a9abe8bb27.zip hqemu-2cd7691fa5ec87e0da711de3e2ff28a9abe8bb27.tar.gz |
vl: Reset location after handling command-line arguments
After looping through all command-line arguments, error location
info becomes obsolete, and any function calling error_report()
will print misleading information. This breaks error reporting
for some option handling, like:
$ qemu-system-x86_64 -icount rr=x -vnc :0
qemu-system-x86_64: -vnc :0: Invalid icount rr option: x
$ qemu-system-x86_64 -m size= -vnc :0
qemu-system-x86_64: -vnc :0: missing 'size' option value
Fix this by resetting location info as soon as we exit the
command-line handling loop.
With this, replay_configure() and set_memory_options() won't
print any location info yet, but at least they won't print
incorrect information.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <1455303747-19776-3-git-send-email-ehabkost@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
["Do not insert code here" comment added to prevent regressions]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r-- | vl.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -4008,6 +4008,11 @@ int main(int argc, char **argv, char **envp) } } } + /* + * Clear error location left behind by the loop. + * Best done right after the loop. Do not insert code here! + */ + loc_set_none(); replay_configure(icount_opts); @@ -4015,8 +4020,6 @@ int main(int argc, char **argv, char **envp) set_memory_options(&ram_slots, &maxram_size, machine_class); - loc_set_none(); - os_daemonize(); if (qemu_init_main_loop(&main_loop_err)) { |