From 06a7521e441c10c000243eca71c556769cb4a482 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 8 Dec 2014 01:25:58 +0000 Subject: fork -> child_spawn in s6-ftrig-listen --- src/pipe-tools/s6-ftrig-listen.c | 13 ++----------- src/pipe-tools/s6-ftrig-listen1.c | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/pipe-tools/s6-ftrig-listen.c b/src/pipe-tools/s6-ftrig-listen.c index 2f6e82b..3683dff 100644 --- 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 index 1354a64..ffb43cc 100644 --- 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 (;;) { -- cgit v1.2.3