From a9ee051a4de06a237be12ab5d25c167f2b0e299a Mon Sep 17 00:00:00 2001 From: "monty@mashka.mysql.fi" <> Date: Sun, 2 Feb 2003 05:13:09 +0200 Subject: [PATCH] Fixed core dump bug in 'mysql' when using \p in prompt on Windows. Fixed error when mysql_unix_port pointed to const string (not uncommon on windows) --- client/mysql.cc | 7 +++++-- sql/mysqld.cc | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 62bdbe15b46..5f84261bd82 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,7 +40,7 @@ #include #include -const char *VER= "12.17"; +const char *VER= "12.18"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -2647,7 +2647,10 @@ static const char* construct_prompt() ! mysql.unix_socket) add_int_to_prompt(mysql.port); else - processed_prompt.append(strrchr(mysql.unix_socket,'/')+1); + { + char *pos=strrchr(mysql.unix_socket,'/'); + processed_prompt.append(pos ? pos+1 : mysql.unix_socket); + } break; case 'U': if (!full_username) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 81aeec05e4d..c26b450cbfe 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2371,9 +2371,9 @@ The server will not act as a slave."); sql_print_error("Warning: Can't create thread to manage maintenance"); } - if (unix_sock == INVALID_SOCKET) - mysql_unix_port[0]= 0; - printf(ER(ER_READY),my_progname,server_version, mysql_unix_port, mysql_port); + printf(ER(ER_READY),my_progname,server_version, + ((unix_sock == INVALID_SOCKET) ? (char*) "" : mysql_unix_port), + mysql_port); fflush(stdout); #ifdef __NT__