]> git.proxmox.com Git - qemu.git/commitdiff
ignore SIGPIPE in qemu-img and qemu-io
authorMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tue, 23 Jul 2013 08:30:11 +0000 (17:30 +0900)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 13 Aug 2013 14:30:50 +0000 (09:30 -0500)
This prevents the tools from being stopped when they write data to a
closed connection in the other side.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 526eda14a68d5b3596be715505289b541288ef2a)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qemu-img.c
qemu-io.c

index cd096a136153811f05a7e9268ebdb08164e5ddf3..2189fc95b9b44ea28c2109d7d67cd2e92428c3aa 100644 (file)
@@ -2460,6 +2460,10 @@ int main(int argc, char **argv)
     const img_cmd_t *cmd;
     const char *cmdname;
 
+#ifdef CONFIG_POSIX
+    signal(SIGPIPE, SIG_IGN);
+#endif
+
     error_set_progname(argv[0]);
 
     qemu_init_main_loop();
index 475a8bd0347a1c037d8b7c33b7beb672ce520dc7..5045ff8035e90d36c925ff06d50175877e37d63e 100644 (file)
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1920,6 +1920,10 @@ int main(int argc, char **argv)
     int opt_index = 0;
     int flags = BDRV_O_UNMAP;
 
+#ifdef CONFIG_POSIX
+    signal(SIGPIPE, SIG_IGN);
+#endif
+
     progname = basename(argv[0]);
 
     while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) {