Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/libbb/bb_askpass.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/libbb/bb_askpass.c
r3232 r3621 2 2 /* 3 3 * Ask for a password 4 * I use a static buffer in this function. Plan accordingly.5 4 * 6 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> … … 24 23 /* Was static char[BIGNUM] */ 25 24 enum { sizeof_passwd = 128 }; 26 static char *passwd;27 25 26 char *passwd; 28 27 char *ret; 29 28 int i; … … 31 30 struct termios tio, oldtio; 32 31 32 tcflush(fd, TCIFLUSH); 33 /* Was buggy: was printing prompt *before* flushing input, 34 * which was upsetting "expect" based scripts of some users. 35 */ 33 36 fputs(prompt, stdout); 34 37 fflush_all(); 35 tcflush(fd, TCIFLUSH);36 38 37 39 tcgetattr(fd, &oldtio); … … 60 62 } 61 63 62 if (!passwd) 63 passwd = xmalloc(sizeof_passwd); 64 passwd = auto_string(xmalloc(sizeof_passwd)); 64 65 ret = passwd; 65 66 i = 0; 66 67 while (1) { 67 68 int r = read(fd, &ret[i], 1); 68 if (r < 0) { 69 if ((i == 0 && r == 0) /* EOF (^D) with no password */ 70 || r < 0 71 ) { 69 72 /* read is interrupted by timeout or ^C */ 70 73 ret = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.