mirror of
https://github.com/sheumann/hush.git
synced 2025-03-02 18:29:22 +00:00
remove strange bloat dup2() usage, sync this code with mainstream login-utils, size reduce
This commit is contained in:
parent
70f7ef7be3
commit
4a9d6d1fe9
@ -528,12 +528,11 @@ static void open_tty(char *tty, struct termio *tp, int local)
|
|||||||
|
|
||||||
/* Open the tty as standard input. */
|
/* Open the tty as standard input. */
|
||||||
|
|
||||||
|
close(0);
|
||||||
debug("open(2)\n");
|
debug("open(2)\n");
|
||||||
fd = open(tty, O_RDWR | O_NONBLOCK, 0);
|
fd = open(tty, O_RDWR | O_NONBLOCK, 0);
|
||||||
if (dup2(fd, STDIN_FILENO) == -1)
|
if (fd != 0)
|
||||||
error("/dev/%s: cannot open as standard input: %m", tty);
|
error("/dev/%s: cannot open as standard input: %m", tty);
|
||||||
close(fd);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user