about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-10-11 07:14:39 +0000
committerUlrich Drepper <drepper@redhat.com>2002-10-11 07:14:39 +0000
commitdb7ffaa3042e02121120a6086aba01c9cecfc46f (patch)
tree9036afafa0dc593bfc901bf56fb798df95fff243 /sysdeps/generic
parent85adacbd9943fbd8f02151f08d6e5e728a4155ac (diff)
downloadglibc-db7ffaa3042e02121120a6086aba01c9cecfc46f.tar.gz
glibc-db7ffaa3042e02121120a6086aba01c9cecfc46f.tar.xz
glibc-db7ffaa3042e02121120a6086aba01c9cecfc46f.zip
Avoid unnecessary sigprocmask calls.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/pselect.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/generic/pselect.c b/sysdeps/generic/pselect.c
index 29f4beaf97..031540e81d 100644
--- a/sysdeps/generic/pselect.c
+++ b/sysdeps/generic/pselect.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -42,7 +42,7 @@ __pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask)
   int retval;
   sigset_t savemask;
 
-  /* Change nanosecond number to microseconds.  This may loose
+  /* Change nanosecond number to microseconds.  This might mean losing
      precision and therefore the `pselect` should be available.  But
      for now it is hardly found.  */
   if (timeout != NULL)
@@ -51,10 +51,14 @@ __pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask)
   /* The setting and restoring of the signal mask and the select call
      should be an atomic operation.  This can't be done without kernel
      help.  */
-  __sigprocmask (SIG_SETMASK, sigmask, &savemask);
+  if (sigmask != NULL)
+    __sigprocmask (SIG_SETMASK, sigmask, &savemask);
+
   retval = __select (nfds, readfds, writefds, exceptfds,
 		     timeout != NULL ? &tval : NULL);
-  __sigprocmask (SIG_SETMASK, &savemask, NULL);
+
+  if (sigmask != NULL)
+    __sigprocmask (SIG_SETMASK, &savemask, NULL);
 
   return retval;
 }