summaryrefslogtreecommitdiff
path: root/src/libstddjb
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb')
-rw-r--r--src/libstddjb/selfpipe_finish.c2
-rw-r--r--src/libstddjb/selfpipe_trapset.c4
-rw-r--r--src/libstddjb/sig_stack.c8
3 files changed, 7 insertions, 7 deletions
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 ;