diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/include/skalibs/nsig.h | 2 | ||||
-rw-r--r-- | src/libstddjb/selfpipe_finish.c | 2 | ||||
-rw-r--r-- | src/libstddjb/selfpipe_trapset.c | 4 | ||||
-rw-r--r-- | src/libstddjb/sig_stack.c | 8 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/include/skalibs/nsig.h b/src/include/skalibs/nsig.h index a75f66d..2cecda9 100644 --- a/src/include/skalibs/nsig.h +++ b/src/include/skalibs/nsig.h @@ -5,7 +5,7 @@ #include <skalibs/nonposix.h> #include <signal.h> -#define SKALIBS_NSIG 64 +#define SKALIBS_NSIG 65 #ifndef NSIG # define NSIG SKALIBS_NSIG diff --git a/src/libstddjb/selfpipe_finish.c b/src/libstddjb/selfpipe_finish.c index 5d9b3fd..0635efb 100644 --- a/src/libstddjb/selfpipe_finish.c +++ b/src/libstddjb/selfpipe_finish.c @@ -25,7 +25,7 @@ void selfpipe_finish (void) void selfpipe_finish (void) { - sig_restoreto(&selfpipe_caught, NSIG) ; + sig_restoreto(&selfpipe_caught, NSIG-1) ; sigemptyset(&selfpipe_caught) ; fd_close(selfpipe[1]) ; fd_close(selfpipe[0]) ; diff --git a/src/libstddjb/selfpipe_trapset.c b/src/libstddjb/selfpipe_trapset.c index ed09b50..33ac861 100644 --- a/src/libstddjb/selfpipe_trapset.c +++ b/src/libstddjb/selfpipe_trapset.c @@ -37,7 +37,7 @@ int selfpipe_trapset (sigset_t const *set) { unsigned int i = 1 ; if (selfpipe_fd < 0) return (errno = EBADF, -1) ; - for (; i <= NSIG ; i++) + for (; i < NSIG ; i++) { int h = sigismember(set, i) ; if (h < 0) continue ; @@ -50,7 +50,7 @@ int selfpipe_trapset (sigset_t const *set) if (sig_restore(i) < 0) break ; } } - if (i <= NSIG) + if (i < NSIG) { int e = errno ; sig_restoreto(set, i) ; diff --git a/src/libstddjb/sig_stack.c b/src/libstddjb/sig_stack.c index c414a88..5897f63 100644 --- a/src/libstddjb/sig_stack.c +++ b/src/libstddjb/sig_stack.c @@ -7,12 +7,12 @@ #include <skalibs/sig.h> #include <skalibs/nsig.h> -static struct skasigaction skasigstack[NSIG][SIGSTACKSIZE] ; -static unsigned int sigsp[NSIG] ; +static struct skasigaction skasigstack[NSIG-1][SIGSTACKSIZE] ; +static unsigned int sigsp[NSIG-1] ; int sig_pusha (int sig, struct skasigaction const *ssa) { - if ((sig <= 0) || (sig > NSIG)) return (errno = EINVAL, -1) ; + if ((sig <= 0) || (sig >= NSIG)) return (errno = EINVAL, -1) ; if (sigsp[sig-1] >= SIGSTACKSIZE) return (errno = ENOBUFS, -1) ; if (skasigaction(sig, ssa, &skasigstack[sig-1][sigsp[sig-1]]) == -1) return -1 ; @@ -21,7 +21,7 @@ int sig_pusha (int sig, struct skasigaction const *ssa) int sig_pop (int sig) { - if ((sig <= 0) || (sig > NSIG)) return (errno = EINVAL, -1) ; + if ((sig <= 0) || (sig >= NSIG)) return (errno = EINVAL, -1) ; if (!sigsp[sig-1]) return (errno = EFAULT, -1); if (skasigaction(sig, &skasigstack[sig-1][sigsp[sig-1]-1], 0) == -1) return -1 ; |