s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

commit 06a7521e441c10c000243eca71c556769cb4a482
parent 0ccb71ef43a4754bf115220e107785f68553f6d1
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Mon,  8 Dec 2014 01:25:58 +0000

fork -> child_spawn in s6-ftrig-listen

Diffstat:
Msrc/pipe-tools/s6-ftrig-listen.c | 13++-----------
Msrc/pipe-tools/s6-ftrig-listen1.c | 13++-----------
2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/src/pipe-tools/s6-ftrig-listen.c b/src/pipe-tools/s6-ftrig-listen.c @@ -78,17 +78,8 @@ int main (int argc, char const **argv, char const *const *envp) if (!ids[i]) strerr_diefu4sys(111, "subscribe to ", argv[i<<1], " with regexp ", argv[(i<<1)+1]) ; } - pid = fork() ; - switch (pid) - { - case -1 : strerr_diefu1sys(111, "fork") ; - case 0 : - { - PROG = "s6-ftrig-listen (child)" ; - pathexec_run(argv[argc1 + 1], argv + argc1 + 1, envp) ; - strerr_dieexec(111, argv[argc1 + 1]) ; - } - } + pid = child_spawn0(argv[argc1 + 1], argv + argc1 + 1, envp) ; + if (!pid) strerr_diefu2sys(111, "spawn ", argv[argc1 + 1]) ; for (;;) { diff --git a/src/pipe-tools/s6-ftrig-listen1.c b/src/pipe-tools/s6-ftrig-listen1.c @@ -65,17 +65,8 @@ int main (int argc, char const *const *argv, char const *const *envp) if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "sig_ignore") ; x[1].fd = ftrigr_fd(&a) ; - pid = fork() ; - switch (pid) - { - case -1 : strerr_diefu1sys(111, "fork") ; - case 0 : - { - PROG = "s6-ftrig-listen1 (child)" ; - pathexec_run(argv[2], argv+2, envp) ; - strerr_dieexec(111, argv[2]) ; - } - } + pid = child_spawn0(argv[2], argv+2, envp) ; + if (!pid) strerr_diefu2sys(111, "spawn ", argv[2]) ; for (;;) {