]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - signal/sighold.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / signal / sighold.c
index 3dcf330f68be815c2656e6f979ba34d0ac0244f0..b99a3841430e65c5901df35c931f6ebfcd2ae9ba 100644 (file)
@@ -1,5 +1,5 @@
 /* Add SIG to the calling process' signal mask.
-   Copyright (C) 1998-2015 Free Software Foundation, Inc.
+   Copyright (C) 1998-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #define __need_NULL
 #include <stddef.h>
 #include <signal.h>
 
 int
-sighold (sig)
-     int sig;
+sighold (int sig)
 {
   sigset_t set;
 
-  /* Retrieve current signal set.  */
-  if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
-    return -1;
-
-  /* Add the specified signal.  */
+  sigemptyset (&set);
   if (sigaddset (&set, sig) < 0)
     return -1;
-
-  /* Set the new mask.  */
-  return __sigprocmask (SIG_SETMASK, &set, NULL);
+  return __sigprocmask (SIG_BLOCK, &set, NULL);
 }