diff mbox

iohandler.c: Properly initialize sigaction struct

Message ID 1400245203-32005-1-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell May 16, 2014, 1 p.m. UTC
The code in qemu_init_child_watch() wasn't clearing the 'struct
sigaction' before passing it to sigaction(); this meant that we
would block a random set of signals while executing the SIGCHLD
handler. Initialize properly by using memset() on the struct,
as we do in similar cases elsewhere.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Pretty harmless, but spotted by coverity.

 iohandler.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael Tokarev May 17, 2014, 7:56 a.m. UTC | #1
16.05.2014 17:00, Peter Maydell wrote:
> The code in qemu_init_child_watch() wasn't clearing the 'struct
> sigaction' before passing it to sigaction(); this meant that we
> would block a random set of signals while executing the SIGCHLD
> handler. Initialize properly by using memset() on the struct,
> as we do in similar cases elsewhere

Applied to -trivial, thank you!

/mjt
diff mbox

Patch

diff --git a/iohandler.c b/iohandler.c
index ae2ef8f..cca614f 100644
--- a/iohandler.c
+++ b/iohandler.c
@@ -191,6 +191,7 @@  static void qemu_init_child_watch(void)
     struct sigaction act;
     sigchld_bh = qemu_bh_new(sigchld_bh_handler, NULL);
 
+    memset(&act, 0, sizeof(act));
     act.sa_handler = sigchld_handler;
     act.sa_flags = SA_NOCLDSTOP;
     sigaction(SIGCHLD, &act, NULL);