summaryrefslogtreecommitdiff
path: root/client/mysql.cc
diff options
context:
space:
mode:
authorunknown <jimw@rama.(none)>2006-07-11 12:42:03 -0700
committerunknown <jimw@rama.(none)>2006-07-11 12:42:03 -0700
commitff8f68d2d5d10d5415d32abeb81f560059dee4bc (patch)
tree1d37210a49c30fbcfb03344405a8baa55abdd7f0 /client/mysql.cc
parent66fc547d1bd6f267e47ac170f3038f5dd6559691 (diff)
downloadmariadb-git-ff8f68d2d5d10d5415d32abeb81f560059dee4bc.tar.gz
Bug #17485: mysql client crashes when connecting to the Instance Manager
Using \U or \u in a prompt with the mysql command-line client could crash when connecting to the instance manager, since it does not return information about the user when asked by the client. This is fixed by having the client use what it knowns about the user (or giving up and saying "(unknown)"). client/mysql.cc: init_username() may not retrieve a username (such as from the instance manager), in which case we fall back to what was specified on the command line (or .cnf file) or finally (unknown).
Diffstat (limited to 'client/mysql.cc')
-rw-r--r--client/mysql.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 6fcda6d766f..f4abffaf445 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3623,12 +3623,14 @@ static const char* construct_prompt()
case 'U':
if (!full_username)
init_username();
- processed_prompt.append(full_username);
+ processed_prompt.append(full_username ? full_username :
+ (current_user ? current_user : "(unknown)"));
break;
case 'u':
if (!full_username)
init_username();
- processed_prompt.append(part_username);
+ processed_prompt.append(part_username ? part_username :
+ (current_user ? current_user : "(unknown)"));
break;
case PROMPT_CHAR:
processed_prompt.append(PROMPT_CHAR);