]> 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)
committerKevin Wolf <kwolf@redhat.com>
Tue, 6 Aug 2013 08:41:56 +0000 (10:41 +0200)
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>
qemu-img.c
qemu-io.c

index dece1b3a3aeda8cbf47a290399d44181f980a54b..b9a848db74de8c77e8a009669ac72fe048bc71cc 100644 (file)
@@ -2322,6 +2322,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 cb9def50e67772582fe7c2f2e4697a4eb69ced6d..d54dc86921bde4d0d47c76d187956c4f7ec4d432 100644 (file)
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -335,6 +335,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) {