qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] iohandler.c: Properly initialize sigaction struct
@ 2014-05-16 13:00 Peter Maydell
  2014-05-17  7:56 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2014-05-16 13:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, patches

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(+)

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);
-- 
1.9.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [Qemu-trivial] [PATCH] iohandler.c: Properly initialize sigaction struct
  2014-05-16 13:00 [Qemu-devel] [PATCH] iohandler.c: Properly initialize sigaction struct Peter Maydell
@ 2014-05-17  7:56 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2014-05-17  7:56 UTC (permalink / raw)
  To: Peter Maydell, qemu-devel; +Cc: qemu-trivial, patches

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-17  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-16 13:00 [Qemu-devel] [PATCH] iohandler.c: Properly initialize sigaction struct Peter Maydell
2014-05-17  7:56 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).