summaryrefslogtreecommitdiff
path: root/src/supervision/s6-svwait.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-02-11 17:38:53 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2021-02-11 17:38:53 +0000
commitc0e09dfe5ff3630f914f1008941a1cfdacbd3db2 (patch)
treefbd1629012b6c6d1ec11c32b8010814616e6eae8 /src/supervision/s6-svwait.c
parent4d157070b438574bb7c5c30cb62a135f056b4289 (diff)
downloads6-c0e09dfe5ff3630f914f1008941a1cfdacbd3db2.tar.xz
bugfix: unignore SIGPIPE before execing a user-controlled process
Diffstat (limited to 'src/supervision/s6-svwait.c')
-rw-r--r--src/supervision/s6-svwait.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/supervision/s6-svwait.c b/src/supervision/s6-svwait.c
index 2fc8fcb..87b9fde 100644
--- a/src/supervision/s6-svwait.c
+++ b/src/supervision/s6-svwait.c
@@ -1,11 +1,15 @@
/* ISC license. */
#include <stdint.h>
+#include <signal.h>
+
#include <skalibs/sgetopt.h>
#include <skalibs/types.h>
#include <skalibs/bitarray.h>
+#include <skalibs/sig.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
+
#include "s6-svlisten.h"
#define USAGE "s6-svwait [ -U | -u | -d | -D ] [ -a | -o ] [ -t timeout ] servicedir..."
@@ -50,6 +54,7 @@ int main (int argc, char const *const *argv)
uint16_t ids[argc] ;
unsigned char upstate[bitarray_div8(argc)] ;
unsigned char readystate[bitarray_div8(argc)] ;
+ if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ;
s6_svlisten_init(argc, argv, &foo, ids, upstate, readystate, &deadline) ;
e = s6_svlisten_loop(&foo, wantup, wantready, or, &deadline, -1, 0) ;
if (e < 0) strerr_dief1x(102, "supervisor died") ;