flush typeahead before prompt
authorpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Wed, 7 Nov 2007 15:51:35 +0000 (15:51 +0000)
committerpgf <pgf@69ca8d6d-28ef-0310-b511-8ec308f3f277>
Wed, 7 Nov 2007 15:51:35 +0000 (15:51 +0000)
git-svn-id: svn://busybox.net/trunk/busybox@20379 69ca8d6d-28ef-0310-b511-8ec308f3f277

loginutils/login.c

index ef27c3b..c1e0c76 100644 (file)
@@ -305,6 +305,10 @@ int login_main(int argc, char **argv)
        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));