mirror of
https://github.com/troglobit/finit.git
synced 2026-10-13 10:14:47 +00:00
Avoid lingering stdout fd logit process
Delay duplication of stdout/stderr until after forking a logit process, otherwise we'd have a ligering reference to stdout/stderr. Signed-off-by: Jacques de Laval <jacques@de-laval.se>
This commit is contained in:
+3
-3
@@ -191,9 +191,6 @@ static int lredirect(svc_t *svc)
|
||||
return -1;
|
||||
}
|
||||
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
int fds;
|
||||
@@ -240,6 +237,9 @@ static int lredirect(svc_t *svc)
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
|
||||
return close(fd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user