]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm: Install SIGPIPE signal handler to ignore signal
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Wed, 25 Oct 2017 15:28:06 +0000 (11:28 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Fri, 27 Oct 2017 12:37:40 +0000 (08:37 -0400)
Install a SIGPIPE signal handler to ignore the signal from trying
to write to a broken pipe.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
src/swtpm/utils.c

index f9d91385040ae7b574bd4ffe1b401a5a8b574835..5b793ade8da080ededcf07f7b3c85e5da255e3c7 100644 (file)
@@ -57,6 +57,11 @@ int install_sighandlers(int pipefd[2], sighandler_t handler)
         goto err_close_pipe;
     }
 
+    if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
+        logprintf(STDERR_FILENO, "Could not install signal handler for SIGPIPE.\n");
+        goto err_close_pipe;
+    }
+
     return 0;
 
 err_close_pipe: