summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2012-02-22 12:14:34 +0100
committerunknown <knielsen@knielsen-hq.org>2012-02-22 12:14:34 +0100
commit9305f2b52f8a219737653fa88ba022c901f2831b (patch)
tree4b00876e2caec3792a3a61b1e084e10d0d0e270f /libmysql
parentf2db5ef4ba128c86d02e6571f9aba907b8ea64c3 (diff)
parent925942e7af49eebc5ffeff705bb2167eb86a9dcb (diff)
downloadmariadb-git-9305f2b52f8a219737653fa88ba022c901f2831b.tar.gz
Merge latest MariaDB 5.5 into MWL#192: Non-blocking client library.
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/get_password.c12
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;
}