Skip to content

Commit

Permalink
vl: Fix an assert failure in error path
Browse files Browse the repository at this point in the history
Based on the description of error_setg(), the local variable err in
qemu_maybe_daemonize() should be initialized to NULL.

Without fix, the uninitialized *errp triggers assert failure which
doesn't show much valuable information.

Before the fix:
qemu-system-x86_64: ../util/error.c:59: error_setv: Assertion `*errp == NULL' failed.

After fix:
qemu-system-x86_64: cannot create PID file: Cannot open pid file: Permission denied

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Message-Id: <20210610084741.456260-1-zhenzhong.duan@intel.com>
Cc: qemu-stable@nongnu.org
Fixes: 0546c06 ("vl: split various early command line options to a separate function", 2020-12-10)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
duanzhenzhong authored and bonzini committed Jun 15, 2021
1 parent b65310a commit 38f7134
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion softmmu/vl.c
Expand Up @@ -2522,7 +2522,7 @@ static void qemu_process_help_options(void)

static void qemu_maybe_daemonize(const char *pid_file)
{
Error *err;
Error *err = NULL;

os_daemonize();
rcu_disable_atfork();
Expand Down

0 comments on commit 38f7134

Please sign in to comment.