From d30b22e5c946e927b549e4df5f3babe192cb8099 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Jun 2008 21:34:47 +0200 Subject: [PATCH] Simplify code. --- ChangeLog | 2 ++ lib/nanosleep.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) 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; } -- 2.11.0