about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/sigwait.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2001-12-26 20:10:32 +0000
committerRoland McGrath <roland@gnu.org>2001-12-26 20:10:32 +0000
commit362f8329ccf0f26d3976dfd9d50b70c97117a5f4 (patch)
tree439ea1c20d85ccb2648199db2d990af3839fb542 /sysdeps/mach/hurd/sigwait.c
parenta5eb7027b941e30678468c30200450e28ba3518c (diff)
downloadglibc-362f8329ccf0f26d3976dfd9d50b70c97117a5f4.tar.gz
glibc-362f8329ccf0f26d3976dfd9d50b70c97117a5f4.tar.xz
glibc-362f8329ccf0f26d3976dfd9d50b70c97117a5f4.zip
* sysdeps/mach/hurd/sigwait.c (__sigwait): When returning immediately,
	check only (SS->pending & MASK) for the signal to return.
	From Jeroen Dekkers <jeroen@dekkers.cx>.

	* iconv/skeleton.c [!RESET_INPUT_BUFFER && !SAVE_RESET_STATE]:
	Use preprocessor #if conditionals instead of `if' to avoid
	warnings about divide by zero in dead code.
Diffstat (limited to 'sysdeps/mach/hurd/sigwait.c')
-rw-r--r--sysdeps/mach/hurd/sigwait.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sysdeps/mach/hurd/sigwait.c b/sysdeps/mach/hurd/sigwait.c
index d44a8a30a7..9ddb89980c 100644
--- a/sysdeps/mach/hurd/sigwait.c
+++ b/sysdeps/mach/hurd/sigwait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996,97,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@ int
 __sigwait (const sigset_t *set, int *sig)
 {
   struct hurd_sigstate *ss;
-  sigset_t mask;
+  sigset_t mask, ready;
   int signo = 0;
   struct hurd_signal_preemptor preemptor;
   jmp_buf buf;
@@ -72,20 +72,21 @@ __sigwait (const sigset_t *set, int *sig)
   ss = _hurd_self_sigstate ();
   __spin_lock (&ss->lock);
 
-  /* See if one of these signals is currently pending */
-  if (ss->pending & mask)
+  /* See if one of these signals is currently pending.  */
+  ready = ss->pending & mask;
+  if (ready)
     {
       for (signo = 1; signo < NSIG; signo++)
-	if (__sigismember (&ss->pending, signo))
+	if (__sigismember (&ready, signo))
 	  {
-	    __sigdelset (&ss->pending, signo);
+	    __sigdelset (&ready, signo);
 	    goto all_done;
 	  }
       /* Huh?  Where'd it go? */
       abort ();
     }
 
-  /* Wait for one of them to show up */
+  /* Wait for one of them to show up.  */
 
   if (!setjmp (buf))
     {