aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/getty.c
diff options
context:
space:
mode:
authorIsaac Dunham <ibid.ag@gmail.com>2014-08-22 23:34:52 -0500
committerIsaac Dunham <ibid.ag@gmail.com>2014-08-22 23:34:52 -0500
commitc106a7861b67e37d5ae7c7abc1abcad75cee0354 (patch)
tree7ad6add4b45dfdb2fee263a4412b7cdc4168673f /toys/pending/getty.c
parente70eea41eeed05e0ac938a6aceab27c918090fde (diff)
downloadtoybox-c106a7861b67e37d5ae7c7abc1abcad75cee0354.tar.gz
getty needs fd 0 to stay open.
The O_CLOEXEC reversal resulted in login failing.
Diffstat (limited to 'toys/pending/getty.c')
-rw-r--r--toys/pending/getty.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/toys/pending/getty.c b/toys/pending/getty.c
index 0cfd750c..c7376288 100644
--- a/toys/pending/getty.c
+++ b/toys/pending/getty.c
@@ -128,7 +128,7 @@ static void open_tty(void)
if ((setsid() < 0) && (getpid() != getsid(0)))
perror_exit("setsid");
xclose(0);
- xopen(TT.tty_name, O_RDWR|O_NDELAY);
+ xopen(TT.tty_name, O_RDWR|O_NDELAY|O_CLOEXEC);
fcntl(0, F_SETFL, fcntl(0, F_GETFL) & ~O_NONBLOCK); // Block read
dup2(0, 1);
dup2(0, 2);