lib/tevent: fix race with signals and tevent_common_add_signal
commit6abb637e3e0d23635fdbbb91c163731b325d696d
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 28 Aug 2009 02:34:22 +0000 (28 12:04 +0930)
committerAndrew Tridgell <tridge@samba.org>
Fri, 28 Aug 2009 04:03:41 +0000 (28 14:03 +1000)
tree0cf9548dbed2a26f7f4a395b243e6f359de4d49b
parent398d0c2929026fccb3409316720a4dcad225ab05
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>
lib/tevent/tevent_signal.c