diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2014-12-08 01:25:58 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2014-12-08 01:25:58 +0000 |
commit | 06a7521e441c10c000243eca71c556769cb4a482 (patch) | |
tree | c8b3a70009e938cd8f17bbdcc19179daf0f8a9cd /src/pipe-tools | |
parent | 0ccb71ef43a4754bf115220e107785f68553f6d1 (diff) | |
download | s6-06a7521e441c10c000243eca71c556769cb4a482.tar.gz s6-06a7521e441c10c000243eca71c556769cb4a482.tar.xz s6-06a7521e441c10c000243eca71c556769cb4a482.zip |
fork -> child_spawn in s6-ftrig-listen
Diffstat (limited to 'src/pipe-tools')
-rw-r--r-- | src/pipe-tools/s6-ftrig-listen.c | 13 | ||||
-rw-r--r-- | src/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 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 (;;) { |