lib/tevent: fix race with signals and tevent_common_add_signal
commitc1011b3a21298fcde7a81a23412b3e2450e15942
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 28 Aug 2009 02:34:22 +0000 (28 12:04 +0930)
committerKarolin Seeger <kseeger@samba.org>
Wed, 9 Sep 2009 10:45:07 +0000 (9 12:45 +0200)
tree39cb166843cca1db0d2fd63a94fae8d24f6da8bf
parentce31ae860d25823f7b5b3140b74e8d83af9d6ed5
lib/tevent: fix race with signals and tevent_common_add_signal

We carefully preserve the old signal handler, but we replace it before
we've set up everything; in particular, if we fail setting up the
pipe_hack we could write a NUL char to stdout (fd 0), instead of
calling the old signal handler.

Replace the signal handler as the very last thing we do.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from commit 6abb637e3e0d23635fdbbb91c163731b325d696d)
(cherry picked from commit bd28ae54a635667096e4a0d1010a1c3cce59712f)
lib/tevent/tevent_signal.c