mirror of
https://github.com/troglobit/finit.git
synced 2026-10-17 10:49:34 +00:00
Do not assume new fd is 0, dup2() with fd instead
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
06d1e90bac
commit
9a03adce5a
1 file changed
+3
-3
@@ -245,9 +245,9 @@ pid_t run_getty(char *cmd, char *args[], int console)
|
||||
if (fd != STDIN_FILENO)
|
||||
exit(1);
|
||||
|
||||
dup2(0, STDIN_FILENO);
|
||||
dup2(0, STDOUT_FILENO);
|
||||
dup2(0, STDERR_FILENO);
|
||||
dup2(fd, STDIN_FILENO);
|
||||
dup2(fd, STDOUT_FILENO);
|
||||
dup2(fd, STDERR_FILENO);
|
||||
|
||||
prctl(PR_SET_NAME, "console", 0, 0, 0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user