mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
svc_start(): Fix swapped arguments to dup2() and add close(fd), descriptor leak.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
8349909f60
commit
a7ff1a61d5
1 file changed
+3
-2
@@ -489,8 +489,9 @@ int svc_start(svc_t *svc)
|
|||||||
|
|
||||||
fd = open(CONSOLE, O_WRONLY | O_APPEND);
|
fd = open(CONSOLE, O_WRONLY | O_APPEND);
|
||||||
if (-1 != fd) {
|
if (-1 != fd) {
|
||||||
dup2(STDOUT_FILENO, fd);
|
dup2(fd, STDOUT_FILENO);
|
||||||
dup2(STDERR_FILENO, fd);
|
dup2(fd, STDERR_FILENO);
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_NUM_SVC_ARGS && args[i]; i++) {
|
for (i = 0; i < MAX_NUM_SVC_ARGS && args[i]; i++) {
|
||||||
|
|||||||
Reference in new issue
Block a user