diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-04-28 12:17:52 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-04-28 12:17:52 +0000 |
commit | 7b7b82031072e75b508d87383e8fd897c6e2cfbe (patch) | |
tree | 4335f8aac3eb054baf8762e09c4f4c9589d1ee6e /src | |
parent | 94f621bc7233e9fdbdfacdcd036de3210c3f9b0b (diff) | |
download | execline-7b7b82031072e75b508d87383e8fd897c6e2cfbe.tar.gz execline-7b7b82031072e75b508d87383e8fd897c6e2cfbe.tar.xz execline-7b7b82031072e75b508d87383e8fd897c6e2cfbe.zip |
Use the new SKALIBS_NSIG in trap.c to accommodate OpenBSD snowflakiness
Diffstat (limited to 'src')
-rw-r--r-- | src/execline/trap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/execline/trap.c b/src/execline/trap.c index be84bda..c588d3c 100644 --- a/src/execline/trap.c +++ b/src/execline/trap.c @@ -20,8 +20,8 @@ #define USAGE "trap [ -x ] [ -t timeout ] { signal { cmdline } ... } prog..." #define dieusage() strerr_dieusage(100, USAGE) ; -static pid_t pids[NSIG + 1] ; -static char const *const *argvs[NSIG] ; +static pid_t pids[SKALIBS_NSIG + 1] ; +static char const *const *argvs[SKALIBS_NSIG] ; static void action (unsigned int i, char const *const *envp) { @@ -33,7 +33,7 @@ static void action (unsigned int i, char const *const *envp) if (!pids[i]) strerr_diefu2sys(111, "spawn ", argvs[i][0]) ; } } - else kill(pids[NSIG], i) ; + else kill(pids[SKALIBS_NSIG], i) ; } int main (int argc, char const **argv, char const *const *envp) @@ -41,7 +41,7 @@ int main (int argc, char const **argv, char const *const *envp) tain_t tto ; int xfersigs = 0 ; int argc1, spfd ; - unsigned int i = NSIG + 1 ; + unsigned int i = SKALIBS_NSIG + 1 ; PROG = "trap" ; { unsigned int t = 0 ; @@ -103,7 +103,7 @@ int main (int argc, char const **argv, char const *const *envp) sigdelset(&full, SIGCHLD) ; sigdelset(&full, SIGKILL) ; sigdelset(&full, SIGSTOP) ; - for (i = 1 ; i < NSIG ; i++) + for (i = 1 ; i < SKALIBS_NSIG ; i++) if (!argvs[i] && sigismember(&full, i) > 0 && selfpipe_trap(i) < 0) { char fmt[UINT_FMT] ; @@ -119,7 +119,7 @@ int main (int argc, char const **argv, char const *const *envp) iopause_fd x = { .fd = spfd, .events = IOPAUSE_READ } ; size_t envlen = env_len(envp) ; char modif[2 + PID_FMT] = "!=" ; - size_t l = 2 + pid_fmt(modif + 2, pids[NSIG]) ; + size_t l = 2 + pid_fmt(modif + 2, pids[SKALIBS_NSIG]) ; char const *newenvp[envlen + 2] ; modif[l++] = 0 ; if (!env_merge(newenvp, envlen + 2, envp, envlen, modif, l)) @@ -146,12 +146,12 @@ int main (int argc, char const **argv, char const *const *envp) for (;;) { int wstat ; - ssize_t id = wait_pids_nohang(pids, NSIG + 1, &wstat) ; + ssize_t id = wait_pids_nohang(pids, SKALIBS_NSIG + 1, &wstat) ; if (id < 0 && errno != ECHILD) strerr_diefu1sys(111, "wait") ; if (id <= 0) break ; pids[id - 1] = 0 ; - if (id == NSIG + 1) return wait_estatus(wstat) ; + if (id == SKALIBS_NSIG + 1) return wait_estatus(wstat) ; } if (!argvs[SIGCHLD]) break ; default : |