mirror of
https://github.com/troglobit/finit.git
synced 2026-11-20 19:41:51 +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:
1 parent
20c5788430
commit
703ae0caf3
1 file changed
+3
-3
+3
-3
@@ -191,9 +191,6 @@ static int lredirect(svc_t *svc)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dup2(fd, STDOUT_FILENO);
|
|
||||||
dup2(fd, STDERR_FILENO);
|
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
int fds;
|
int fds;
|
||||||
@@ -240,6 +237,9 @@ static int lredirect(svc_t *svc)
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dup2(fd, STDOUT_FILENO);
|
||||||
|
dup2(fd, STDERR_FILENO);
|
||||||
|
|
||||||
return close(fd);
|
return close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user