diff options
Diffstat (limited to 'src/sentinel.c')
-rw-r--r-- | src/sentinel.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index 1d44763..59b89cc 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -128,48 +128,50 @@ wait_loop(pid_t child, int out, int err) log_buffer_read(err, &ebuf); } } _exit(1); } pid_t start_command(int p[]) { int errpipe[2], outpipe[2]; pid_t pid; xpipe(errpipe); xpipe(outpipe); pid = fork(); if (pid == -1) { system_error(errno, "pipe"); return -1; } if (pid == 0) { char *argv[] = { SHELL, "-c", NULL, NULL }; int i; + runas(); + close(0); close(1); close(2); open("/dev/null", O_RDWR); dup(outpipe[1]); dup(errpipe[1]); i = max(max(outpipe[0],outpipe[1]), max(errpipe[0],errpipe[1])); while (--i > 2) close(i); argv[2] = genrc_command; execvp(SHELL, argv); system_error(errno, "failed to exec %s", genrc_program); exit(127); } write_pid_file(pid); close(outpipe[1]); close(errpipe[1]); p[0] = outpipe[0]; |