OSDN Git Service

Make xopen() skip stdin/stdout/stderr, add xopen_stdio() if you want stdout,
[android-x86/external-toybox.git] / toys / pending / getty.c
index a3f665d..25d04ea 100644 (file)
@@ -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_stdio(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);
@@ -165,7 +165,7 @@ static void termios_init(void)
   TT.termios.c_cc[VEOF] = CTL('D');
   TT.termios.c_cc[VEOL] = '\n';
   TT.termios.c_cc[VKILL] = CTL('U');
-  TT.termios.c_cc[VERASE] = CERASE;
+  TT.termios.c_cc[VERASE] = 127; // CERASE
   TT.termios.c_iflag = ICRNL|IXON|IXOFF;
   // set non-zero baud rate. Zero baud rate left it unchanged.
   if (TT.speeds[0] != B0) cfsetspeed(&TT.termios, TT.speeds[0]);