mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 22:13:01 +07: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:
@@ -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