diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-10-22 06:27:41 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-10-22 06:27:41 +0200 |
commit | 7449e18190b8ed07a7cd1711b40885ae4b97efb4 (patch) | |
tree | c6913f5cab94f304f49731d7700d7afa30fd2a2a /libbb | |
parent | ef5a2d757a963fa50807c0abc8cb65be8657c8ee (diff) | |
download | busybox-w32-7449e18190b8ed07a7cd1711b40885ae4b97efb4.tar.gz busybox-w32-7449e18190b8ed07a7cd1711b40885ae4b97efb4.tar.bz2 busybox-w32-7449e18190b8ed07a7cd1711b40885ae4b97efb4.zip |
getty,login: tighten up handling of ctty, pgrp, and tty attr restoring on timeout
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/bb_askpass.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c index 9a4188f52..fe2b50677 100644 --- a/libbb/bb_askpass.c +++ b/libbb/bb_askpass.c | |||
@@ -30,14 +30,23 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt) | |||
30 | struct sigaction sa, oldsa; | 30 | struct sigaction sa, oldsa; |
31 | struct termios tio, oldtio; | 31 | struct termios tio, oldtio; |
32 | 32 | ||
33 | tcgetattr(fd, &oldtio); | 33 | fputs(prompt, stdout); |
34 | fflush_all(); | ||
34 | tcflush(fd, TCIFLUSH); | 35 | tcflush(fd, TCIFLUSH); |
36 | |||
37 | tcgetattr(fd, &oldtio); | ||
35 | tio = oldtio; | 38 | tio = oldtio; |
36 | #ifndef IUCLC | 39 | #if 0 |
37 | # define IUCLC 0 | 40 | /* Switch off UPPERCASE->lowercase conversion (never used since 198x) |
38 | #endif | 41 | * and XON/XOFF (why we want to mess with this??) |
42 | */ | ||
43 | # ifndef IUCLC | ||
44 | # define IUCLC 0 | ||
45 | # endif | ||
39 | tio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); | 46 | tio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); |
40 | tio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP); | 47 | #endif |
48 | /* Switch off echo */ | ||
49 | tio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL); | ||
41 | tcsetattr(fd, TCSANOW, &tio); | 50 | tcsetattr(fd, TCSANOW, &tio); |
42 | 51 | ||
43 | memset(&sa, 0, sizeof(sa)); | 52 | memset(&sa, 0, sizeof(sa)); |
@@ -50,9 +59,6 @@ char* FAST_FUNC bb_ask(const int fd, int timeout, const char *prompt) | |||
50 | alarm(timeout); | 59 | alarm(timeout); |
51 | } | 60 | } |
52 | 61 | ||
53 | fputs(prompt, stdout); | ||
54 | fflush_all(); | ||
55 | |||
56 | if (!passwd) | 62 | if (!passwd) |
57 | passwd = xmalloc(sizeof_passwd); | 63 | passwd = xmalloc(sizeof_passwd); |
58 | ret = passwd; | 64 | ret = passwd; |