summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2010-04-08 15:58:04 +0200
committerSergei Golubchik <sergii@pisem.net>2010-04-08 15:58:04 +0200
commitc277c43a30c8e1d4177ccf7630b9c4c808a20010 (patch)
treefb02891faf937f89c8ef20851ac58fbcbb2230e0 /plugin
parent6e294768dc0a4beadcfd9a4d61701548831d9ccb (diff)
downloadmariadb-git-c277c43a30c8e1d4177ccf7630b9c4c808a20010.tar.gz
fix dialog plugin to work again
(fgets, unlike gets, does not strip \n)
Diffstat (limited to 'plugin')
-rw-r--r--plugin/auth/dialog.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/auth/dialog.c b/plugin/auth/dialog.c
index 4fa1b5e66e5..72c6364f49a 100644
--- a/plugin/auth/dialog.c
+++ b/plugin/auth/dialog.c
@@ -226,11 +226,17 @@ static char *builtin_ask(MYSQL *mysql __attribute__((unused)),
const char *prompt,
char *buf, int buf_len)
{
+ int len;
+
fputs(prompt, stdout);
fputc(' ', stdout);
if (fgets(buf, buf_len, stdin) == 0)
return 0;
+ len= strlen(buf);
+ if (len && buf[len-1]=='\n')
+ buf[len-1]=0;
+
return buf;
}