flush typeahead in login

Paul Fox pgf at brightstareng.com
Mon Nov 5 09:00:01 PST 2007


when getty emits its first prompt, it flushes typeahead beforehand.

login (which emits the later prompts) does not.

any reason is shouldn't?

paul

--- loginutils/login.c	5 Nov 2007 13:45:40 -0000	1.1
+++ loginutils/login.c	5 Nov 2007 16:59:40 -0000
@@ -291,6 +291,10 @@
 	openlog(applet_name, LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH);
 
 	while (1) {
+
+ 		/* flush away any type-ahead (as getty does) */
+ 		(void) ioctl(0, TCFLSH, TCIFLUSH);
+ 
 		if (!username[0])
 			get_username_or_die(username, sizeof(username));
 



=---------------------
 paul fox, pgf at brightstareng.com


More information about the busybox mailing list