Commit bc00893d authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Change back service name to MySQL

Don't add service name to read config file segments if it's "MySQL"
Fixed possible memory leak when CHANGE USER failed.
parent 76ff0478
......@@ -31,7 +31,7 @@
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
#define MYSQL_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "mysqld"
#define MYSQL_SERVICENAME "MySQL"
#endif /* __WIN__ */
enum enum_server_command {
......
......@@ -401,7 +401,9 @@ static void usage(void)
Change the character set used by the index\n\
-q, --quick Faster repair by not modifying the data file.\n\
One can give a second '-q' to force myisamchk to\n\
modify the original datafile in case of duplicate keys\n\
modify the original datafile in case of duplicate keys.\n\
NOTE: Tables where the data file is currupted can't be\n\
fixed with this option.\n\
-u, --unpack Unpack file packed with myisampack.\n\
");
......@@ -1094,7 +1096,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
filename));
if (param->testflag & T_REP_ANY)
VOID(fprintf(stderr,
"Try fixing it by using the --safe-recover (-o) or the --force (-f) option\n"));
"Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag\n"));
}
else if (!(param->error_printed & 2) &&
!(param->testflag & T_FORCE_CREATE))
......
......@@ -2615,10 +2615,16 @@ int main(int argc, char **argv)
if (!default_service_handling(argv, MYSQL_SERVICENAME, MYSQL_SERVICENAME,
file_path, ""))
return 0;
if (Service.IsService(argv[1]))
if (Service.IsService(argv[1])) /* Start an optional service */
{
/* start an optional service */
load_default_groups[3]= argv[1];
/*
Only add the service name to the groups read from the config file
if it's not "MySQL". (The default service name should be 'mysqld'
but we started a bad tradition by calling it MySQL from the start
and we are now stuck with it.
*/
if (my_strcasecmp(argv[1],"mysql"))
load_default_groups[3]= argv[1];
start_mode= 1;
Service.Init(argv[1], mysql_service);
return 0;
......
......@@ -1013,14 +1013,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char *save_user= thd->user;
char *save_priv_user= thd->priv_user;
char *save_db= thd->db;
thd->user=0;
USER_CONN *save_uc= thd->user_connect;
USER_CONN *save_user_connect= thd->user_connect;
if ((uint) ((uchar*) db - net->read_pos) > packet_length)
{ // Check if protocol is ok
send_error(net, ER_UNKNOWN_COM_ERROR);
break;
}
/* Clear variables that are allocated */
thd->user= 0;
thd->user_connect= 0;
if (check_user(thd, COM_CHANGE_USER, user, passwd, db, 0))
{ // Restore old user
x_free(thd->user);
......@@ -1030,10 +1033,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->db_length=save_db_length;
thd->user=save_user;
thd->priv_user=save_priv_user;
thd->user_connect= save_user_connect;
break;
}
if (save_uc)
decrease_user_connections(save_uc);
if (save_user_connect)
decrease_user_connections(save_user_connect);
x_free((gptr) save_db);
x_free((gptr) save_user);
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment