diff options
author | Igor Babaev <igor@askmonty.org> | 2012-02-01 15:48:02 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2012-02-01 15:48:02 -0800 |
commit | 7b79d8a33f56d178c78209f910a0694807a63f8f (patch) | |
tree | 3d4a8131e8688c6599461bfce72bb87c718a53e4 /libmysql | |
parent | 7ed15e6e50aec65560d8988fc5713f1f489b6616 (diff) | |
parent | 81690cf326e09799ca77d9f7bc5601905b706548 (diff) | |
download | mariadb-git-7b79d8a33f56d178c78209f910a0694807a63f8f.tar.gz |
Merge 5.2->5.3 in preparation for the release of mariadb-5.3.4-rc.
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 747d598d72a..21200acf512 100644 --- a/libmysql/get_password.c +++ b/libmysql/get_password.c @@ -82,9 +82,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) { @@ -93,15 +93,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"); } @@ -148,8 +146,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; } |