changeset 10232:7faa680288e0

Simplify code.
author Bruno Haible <bruno@clisp.org>
date Sun, 22 Jun 2008 21:34:47 +0200
parents 32f7d74b65e8
children 5c92e27f02d2
files ChangeLog lib/nanosleep.c
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jun 22 21:07:54 2008 +0200
+++ b/ChangeLog	Sun Jun 22 21:34:47 2008 +0200
@@ -1,5 +1,7 @@
 2008-06-22  Bruno Haible  <bruno@clisp.org>
 
+	* lib/nanosleep.c (rpl_nanosleep): Setup newact only when it is needed.
+
 	* lib/sigprocmask.c: Update a comment.
 
 2008-06-21  Eric Blake  <ebb9@byu.net>
--- a/lib/nanosleep.c	Sun Jun 22 21:07:54 2008 +0200
+++ b/lib/nanosleep.c	Sun Jun 22 21:34:47 2008 +0200
@@ -147,14 +147,18 @@
   /* 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;
     }