diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-02-15 18:08:08 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-02-15 18:08:08 +0100 |
commit | 25609313ffbd9205e921d0793cf423f711d10ced (patch) | |
tree | f04a1c26fabcc5463aca51a860f03131e02d94f7 /libmysql | |
parent | 47a54a2e087a7c1fc861bcbc114c14987f492cfe (diff) | |
parent | 764eeeee74f999fe2107fc362236563be0025093 (diff) | |
download | mariadb-git-25609313ffbd9205e921d0793cf423f711d10ced.tar.gz |
5.3.4 merge
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/get_password.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libmysql/get_password.c b/libmysql/get_password.c index c3428dd2838..a10d112ccd0 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -71,9 +71,9 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length) _cputs(opt_message ? opt_message : "Enter password: "); for (;;) { - char tmp; + int tmp; tmp=_getch(); - if (tmp == '\b' || (int) tmp == 127) + if (tmp == '\b' || tmp == 127) { if (pos != to) { @@ -82,15 +82,13 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length) continue; } } - if (tmp == '\n' || tmp == '\r' || tmp == 3) + if (tmp == -1 || tmp == '\n' || tmp == '\r' || tmp == 3) break; if (iscntrl(tmp) || pos == end) continue; _cputs("*"); - *(pos++) = tmp; + *(pos++) = (char)tmp; } - while (pos != to && isspace(pos[-1]) == ' ') - pos--; /* Allow dummy space at end */ *pos=0; _cputs("\n"); } @@ -137,8 +135,6 @@ static void get_password(char *to,uint length,int fd, my_bool echo) } *(pos++) = tmp; } - while (pos != to && isspace(pos[-1]) == ' ') - pos--; /* Allow dummy space at end */ *pos=0; return; } |