Calling error_get_progname() in the context of qemu-nbd can cause
segmentation fault because qemu-nbd doesn't initialize its progname
with error_set_progname(). This patch adds the initialization.

Currently, the missing call of error_set_progname() doesn't cause any
problems because qemu-nbd doesn't use error_get_progname(). This patch
is a proactive action.

Cc: Paolo Bonzini <pbonz...@redhat.com>
Cc: Markus Armbruster <arm...@redhat.com>
Signed-off-by: Hitoshi Mitake <mitake.hito...@lab.ntt.co.jp>
---
 qemu-nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index d222512..fad5634 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -449,6 +449,7 @@ int main(int argc, char **argv)
     sa_sigterm.sa_handler = termsig_handler;
     sigaction(SIGTERM, &sa_sigterm, NULL);
     qemu_init_exec_dir(argv[0]);
+    error_set_progname(argv[0]);
 
     while ((ch = getopt_long(argc, argv, sopt, lopt, &opt_ind)) != -1) {
         switch (ch) {
-- 
1.9.1


Reply via email to