From: Bruno Haible Date: Sun, 22 Jun 2008 19:34:47 +0000 (+0200) Subject: Simplify code. X-Git-Tag: v0.1~7238 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=d30b22e5c946e927b549e4df5f3babe192cb8099;p=gnulib.git Simplify code. --- diff --git a/ChangeLog b/ChangeLog index c9d6fa1d0..cce3c6e35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2008-06-22 Bruno Haible + * lib/nanosleep.c (rpl_nanosleep): Setup newact only when it is needed. + * lib/sigprocmask.c: Update a comment. 2008-06-21 Eric Blake diff --git a/lib/nanosleep.c b/lib/nanosleep.c index 1732c599b..e413c5db0 100644 --- a/lib/nanosleep.c +++ b/lib/nanosleep.c @@ -147,14 +147,18 @@ rpl_nanosleep (const struct timespec *requested_delay, /* set up sig handler */ if (! initialized) { - struct sigaction oldact, newact; - newact.sa_handler = sighandler; - sigemptyset (&newact.sa_mask); - newact.sa_flags = 0; + struct sigaction oldact; sigaction (SIGCONT, NULL, &oldact); if (get_handler (&oldact) != SIG_IGN) - sigaction (SIGCONT, &newact, NULL); + { + struct sigaction newact; + + newact.sa_handler = sighandler; + sigemptyset (&newact.sa_mask); + newact.sa_flags = 0; + sigaction (SIGCONT, &newact, NULL); + } initialized = true; }