aboutsummaryrefslogtreecommitdiff
path: root/loginutils/getty.c
diff options
context:
space:
mode:
Diffstat (limited to 'loginutils/getty.c')
-rw-r--r--loginutils/getty.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c
index 8b0e729fb..0f536888b 100644
--- a/loginutils/getty.c
+++ b/loginutils/getty.c
@@ -279,7 +279,7 @@ static void termios_init(struct termios *tp, int speed, struct options *op)
279 */ 279 */
280#ifdef __linux__ 280#ifdef __linux__
281 /* flush input and output queues, important for modems! */ 281 /* flush input and output queues, important for modems! */
282 ioctl(0, TCFLSH, TCIOFLUSH); 282 ioctl(0, TCFLSH, TCIOFLUSH); /* tcflush(0, TCIOFLUSH)? - same */
283#endif 283#endif
284 284
285 tp->c_cflag = CS8 | HUPCL | CREAD | speed; 285 tp->c_cflag = CS8 | HUPCL | CREAD | speed;
@@ -297,7 +297,7 @@ static void termios_init(struct termios *tp, int speed, struct options *op)
297 tp->c_cflag |= CRTSCTS; 297 tp->c_cflag |= CRTSCTS;
298#endif 298#endif
299 299
300 ioctl(0, TCSETS, tp); 300 tcsetattr_stdin_TCSANOW(tp);
301 301
302 debug("term_io 2\n"); 302 debug("term_io 2\n");
303} 303}
@@ -334,7 +334,7 @@ static void auto_baud(char *buf, unsigned size_buf, struct termios *tp)
334 tp->c_iflag |= ISTRIP; /* enable 8th-bit stripping */ 334 tp->c_iflag |= ISTRIP; /* enable 8th-bit stripping */
335 vmin = tp->c_cc[VMIN]; 335 vmin = tp->c_cc[VMIN];
336 tp->c_cc[VMIN] = 0; /* don't block if queue empty */ 336 tp->c_cc[VMIN] = 0; /* don't block if queue empty */
337 ioctl(0, TCSETS, tp); 337 tcsetattr_stdin_TCSANOW(tp);
338 338
339 /* 339 /*
340 * Wait for a while, then read everything the modem has said so far and 340 * Wait for a while, then read everything the modem has said so far and
@@ -359,7 +359,7 @@ static void auto_baud(char *buf, unsigned size_buf, struct termios *tp)
359 /* Restore terminal settings. Errors will be dealt with later on. */ 359 /* Restore terminal settings. Errors will be dealt with later on. */
360 tp->c_iflag = iflag; 360 tp->c_iflag = iflag;
361 tp->c_cc[VMIN] = vmin; 361 tp->c_cc[VMIN] = vmin;
362 ioctl(0, TCSETS, tp); 362 tcsetattr_stdin_TCSANOW(tp);
363} 363}
364 364
365/* do_prompt - show login prompt, optionally preceded by /etc/issue contents */ 365/* do_prompt - show login prompt, optionally preceded by /etc/issue contents */
@@ -404,7 +404,7 @@ static char *get_logname(char *logname, unsigned size_logname,
404 404
405 /* Flush pending input (esp. after parsing or switching the baud rate). */ 405 /* Flush pending input (esp. after parsing or switching the baud rate). */
406 sleep(1); 406 sleep(1);
407 ioctl(0, TCFLSH, TCIFLUSH); 407 ioctl(0, TCFLSH, TCIFLUSH); /* tcflush(0, TCIOFLUSH)? - same */
408 408
409 /* Prompt for and read a login name. */ 409 /* Prompt for and read a login name. */
410 logname[0] = '\0'; 410 logname[0] = '\0';
@@ -552,12 +552,13 @@ static void termios_final(struct options *op, struct termios *tp, struct chardat
552 } 552 }
553#endif 553#endif
554 /* Optionally enable hardware flow control */ 554 /* Optionally enable hardware flow control */
555#ifdef CRTSCTS 555#ifdef CRTSCTS
556 if (op->flags & F_RTSCTS) 556 if (op->flags & F_RTSCTS)
557 tp->c_cflag |= CRTSCTS; 557 tp->c_cflag |= CRTSCTS;
558#endif 558#endif
559 559
560 /* Finally, make the new settings effective */ 560 /* Finally, make the new settings effective */
561 /* It's tcsetattr_stdin_TCSANOW() + error check */
561 ioctl_or_perror_and_die(0, TCSETS, tp, "%s: TCSETS", op->tty); 562 ioctl_or_perror_and_die(0, TCSETS, tp, "%s: TCSETS", op->tty);
562} 563}
563 564
@@ -689,6 +690,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
689 * by patching the SunOS kernel variable "zsadtrlow" to a larger value; 690 * by patching the SunOS kernel variable "zsadtrlow" to a larger value;
690 * 5 seconds seems to be a good value. 691 * 5 seconds seems to be a good value.
691 */ 692 */
693 /* tcgetattr() + error check */
692 ioctl_or_perror_and_die(0, TCGETS, &termios, "%s: TCGETS", options.tty); 694 ioctl_or_perror_and_die(0, TCGETS, &termios, "%s: TCGETS", options.tty);
693 695
694#ifdef __linux__ 696#ifdef __linux__
@@ -753,7 +755,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
753 baud_index = (baud_index + 1) % options.numspeed; 755 baud_index = (baud_index + 1) % options.numspeed;
754 termios.c_cflag &= ~CBAUD; 756 termios.c_cflag &= ~CBAUD;
755 termios.c_cflag |= options.speeds[baud_index]; 757 termios.c_cflag |= options.speeds[baud_index];
756 ioctl(0, TCSETS, &termios); 758 tcsetattr_stdin_TCSANOW(&termios);
757 } 759 }
758 } 760 }
759 761