changeset 1443:27f608badc20 draft

getty needs fd 0 to stay open. The O_CLOEXEC reversal resulted in login failing.
author Isaac Dunham <ibid.ag@gmail.com>
date Fri, 22 Aug 2014 23:34:52 -0500
parents f3a41f485d68
children 07e74271655e
files toys/pending/getty.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/toys/pending/getty.c	Wed Aug 20 22:23:39 2014 -0500
+++ b/toys/pending/getty.c	Fri Aug 22 23:34:52 2014 -0500
@@ -128,7 +128,7 @@
     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);