1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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.
This commit is contained in:
monty@narttu.mysql.fi
2003-10-30 01:01:53 +02:00
parent 76ff047819
commit bc00893d16
4 changed files with 22 additions and 10 deletions

View File

@ -31,7 +31,7 @@
#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) #if defined(__WIN__) && !defined( _CUSTOMCONFIG_)
#define MYSQL_NAMEDPIPE "MySQL" #define MYSQL_NAMEDPIPE "MySQL"
#define MYSQL_SERVICENAME "mysqld" #define MYSQL_SERVICENAME "MySQL"
#endif /* __WIN__ */ #endif /* __WIN__ */
enum enum_server_command { enum enum_server_command {

View File

@ -401,7 +401,9 @@ static void usage(void)
Change the character set used by the index\n\ Change the character set used by the index\n\
-q, --quick Faster repair by not modifying the data file.\n\ -q, --quick Faster repair by not modifying the data file.\n\
One can give a second '-q' to force myisamchk to\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\ -u, --unpack Unpack file packed with myisampack.\n\
"); ");
@ -1094,7 +1096,7 @@ end2:
filename)); filename));
if (param->testflag & T_REP_ANY) if (param->testflag & T_REP_ANY)
VOID(fprintf(stderr, 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) && else if (!(param->error_printed & 2) &&
!(param->testflag & T_FORCE_CREATE)) !(param->testflag & T_FORCE_CREATE))

View File

@ -2615,10 +2615,16 @@ int main(int argc, char **argv)
if (!default_service_handling(argv, MYSQL_SERVICENAME, MYSQL_SERVICENAME, if (!default_service_handling(argv, MYSQL_SERVICENAME, MYSQL_SERVICENAME,
file_path, "")) file_path, ""))
return 0; 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; start_mode= 1;
Service.Init(argv[1], mysql_service); Service.Init(argv[1], mysql_service);
return 0; return 0;

View File

@ -1013,14 +1013,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char *save_user= thd->user; char *save_user= thd->user;
char *save_priv_user= thd->priv_user; char *save_priv_user= thd->priv_user;
char *save_db= thd->db; char *save_db= thd->db;
thd->user=0; USER_CONN *save_user_connect= thd->user_connect;
USER_CONN *save_uc= thd->user_connect;
if ((uint) ((uchar*) db - net->read_pos) > packet_length) if ((uint) ((uchar*) db - net->read_pos) > packet_length)
{ // Check if protocol is ok { // Check if protocol is ok
send_error(net, ER_UNKNOWN_COM_ERROR); send_error(net, ER_UNKNOWN_COM_ERROR);
break; break;
} }
/* Clear variables that are allocated */
thd->user= 0;
thd->user_connect= 0;
if (check_user(thd, COM_CHANGE_USER, user, passwd, db, 0)) if (check_user(thd, COM_CHANGE_USER, user, passwd, db, 0))
{ // Restore old user { // Restore old user
x_free(thd->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->db_length=save_db_length;
thd->user=save_user; thd->user=save_user;
thd->priv_user=save_priv_user; thd->priv_user=save_priv_user;
thd->user_connect= save_user_connect;
break; break;
} }
if (save_uc) if (save_user_connect)
decrease_user_connections(save_uc); decrease_user_connections(save_user_connect);
x_free((gptr) save_db); x_free((gptr) save_db);
x_free((gptr) save_user); x_free((gptr) save_user);
break; break;