diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-04-07 14:58:41 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-04-07 14:58:41 +0000 |
commit | 7438b7a3203502cf5a61be4cc8e8fe4c98baa6d1 (patch) | |
tree | f7b1ed75de1b6fb3f9b290181ef2fea322056974 | |
parent | 7ccec47d5939add42b7875c094268ebd83c4f0e5 (diff) | |
download | s6-rc-7438b7a3203502cf5a61be4cc8e8fe4c98baa6d1.tar.xz |
Simplify selfpipe management
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r-- | src/s6-rc/s6-rc.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/s6-rc/s6-rc.c b/src/s6-rc/s6-rc.c index 0496239..e4822a3 100644 --- a/src/s6-rc/s6-rc.c +++ b/src/s6-rc/s6-rc.c @@ -389,9 +389,9 @@ static inline int handle_signals (int h) } } -static int doit (int spfd, int h) +static int doit (int h) { - iopause_fd x = { .fd = spfd, .events = IOPAUSE_READ } ; + iopause_fd x = { .fd = selfpipe_fd(), .events = IOPAUSE_READ } ; int exitcode = 0 ; unsigned int i = n ; pidindex_t pidindexblob[n] ; @@ -554,7 +554,6 @@ int main (int argc, char const *const *argv) /* Allocate enough stack for the db */ { - int spfd ; s6rc_service_t serviceblob[n] ; char const *argvblob[dbblob.nargvs] ; uint32_t depsblob[dbblob.ndeps << 1] ; @@ -658,8 +657,7 @@ int main (int argc, char const *const *argv) /* Perform a state change */ - spfd = selfpipe_init() ; - if (spfd < 0) strerr_diefu1sys(111, "init selfpipe") ; + if (selfpipe_init() == -1) strerr_diefu1sys(111, "init selfpipe") ; { sigset_t set ; sigemptyset(&set) ; @@ -674,12 +672,12 @@ int main (int argc, char const *const *argv) { int r ; if (up) invert_selection() ; - r = doit(spfd, 0) ; + r = doit(0) ; if (r) return r ; invert_selection() ; - return doit(spfd, 1) ; + return doit(1) ; } - else return doit(spfd, up) ; + else return doit(up) ; } } } |