summaryrefslogtreecommitdiff
path: root/src/libstddjb/sig_restoreto.c
blob: e40f75b5e945dcc54cf05194034729bcf5180780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* ISC license. */

/* MT-unsafe */

#include <errno.h>
#include <signal.h>

#include <skalibs/sig.h>

void sig_restoreto (sigset_t const *set, unsigned int n)
{
  int e = errno ;
  unsigned int i = 1 ;
  for (; i < n ; i++)
  {
    int h = sigismember(set, i) ;
    if (h < 0) continue ;
    if (h) sig_restore(i) ;
  }
  errno = e ;
}