Skip to content

Commit b04af44

Browse files
author
hf@deer.(none)
committed
Fix for Windows bug reported throuhg Miguel
1 parent e8216b4 commit b04af44

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

libmysqld/lib_sql.cc

-5
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,6 @@ void STDCALL mysql_server_end()
435435
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
436436
copy_arguments_ptr=0;
437437
clean_up(0);
438-
#ifdef THREAD
439-
/* Don't call my_thread_end() if the application is using MY_INIT() */
440-
if (!org_my_init_done)
441-
my_thread_end();
442-
#endif
443438
/* If library called my_init(), free memory allocated by it */
444439
if (!org_my_init_done)
445440
my_end(0);

sql/derror.cc

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,28 @@
2020
#include "mysql_priv.h"
2121
#include "mysys_err.h"
2222

23-
static void read_texts(const char *file_name,const char ***point,
23+
static bool read_texts(const char *file_name,const char ***point,
2424
uint error_messages);
2525
static void init_myfunc_errs(void);
2626

2727
/* Read messages from errorfile */
2828

29-
void init_errmessage(void)
29+
bool init_errmessage(void)
3030
{
3131
DBUG_ENTER("init_errmessage");
3232

33-
read_texts(ERRMSG_FILE,&my_errmsg[ERRMAPP],ER_ERROR_MESSAGES);
33+
if (read_texts(ERRMSG_FILE,&my_errmsg[ERRMAPP],ER_ERROR_MESSAGES))
34+
DBUG_RETURN(TRUE);
3435
errmesg=my_errmsg[ERRMAPP]; /* Init global variabel */
3536
init_myfunc_errs(); /* Init myfunc messages */
36-
DBUG_VOID_RETURN;
37+
DBUG_RETURN(FALSE);
3738
}
3839

3940

4041
/* Read text from packed textfile in language-directory */
4142
/* If we can't read messagefile then it's panic- we can't continue */
4243

43-
static void read_texts(const char *file_name,const char ***point,
44+
static bool read_texts(const char *file_name,const char ***point,
4445
uint error_messages)
4546
{
4647
register uint i;
@@ -116,7 +117,7 @@ Check that the above file is the right version for this program!",
116117
point[i]= *point +uint2korr(head+10+i+i);
117118
}
118119
VOID(my_close(file,MYF(0)));
119-
DBUG_VOID_RETURN;
120+
DBUG_RETURN(FALSE);
120121

121122
err:
122123
switch (funktpos) {

sql/init.cc

+2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ void unireg_init(ulong options)
3737
#ifdef USE_MY_ATOF
3838
init_my_atof(); /* use our atof */
3939
#endif
40+
#ifndef EMBEDDED_LIBRARY
4041
my_abort_hook=unireg_abort; /* Abort with close of databases */
42+
#endif
4143

4244
VOID(strmov(reg_ext,".frm"));
4345
for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS

sql/mysql_priv.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ void key_restore(TABLE *form,byte *key,uint index,uint key_length);
725725
int key_cmp(TABLE *form,const byte *key,uint index,uint key_length);
726726
void key_unpack(String *to,TABLE *form,uint index);
727727
bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields);
728-
void init_errmessage(void);
728+
bool init_errmessage(void);
729729

730730
void sql_perror(const char *message);
731731
void sql_print_error(const char *format,...)
@@ -919,7 +919,11 @@ void calc_time_from_sec(TIME *to, long seconds, long microseconds);
919919

920920
int test_if_number(char *str,int *res,bool allow_wildcards);
921921
void change_byte(byte *,uint,char,char);
922+
#ifndef EMBEDDED_LIBRARY
922923
extern "C" void unireg_abort(int exit_code);
924+
#else
925+
#define unireg_abort(exit_code) DBUG_RETURN(exit_code)
926+
#endif
923927
void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
924928
SQL_SELECT *select,
925929
int use_record_cache, bool print_errors);

sql/mysqld.cc

+10-5
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,7 @@ extern "C" sig_handler print_signal_warning(int sig)
845845
(Mac OS X) we have to call exit() instead if pthread_exit().
846846
*/
847847

848+
#ifndef EMBEDDED_LIBRARY
848849
void unireg_end(void)
849850
{
850851
clean_up(1);
@@ -856,7 +857,6 @@ void unireg_end(void)
856857
#endif
857858
}
858859

859-
860860
extern "C" void unireg_abort(int exit_code)
861861
{
862862
DBUG_ENTER("unireg_abort");
@@ -868,7 +868,7 @@ extern "C" void unireg_abort(int exit_code)
868868
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
869869
exit(exit_code); /* purecov: inspected */
870870
}
871-
871+
#endif
872872

873873
void clean_up(bool print_message)
874874
{
@@ -1015,6 +1015,7 @@ static void set_ports()
10151015
}
10161016
}
10171017

1018+
#ifndef EMBEDDED_LIBRARY
10181019
/* Change to run as another user if started with --user */
10191020

10201021
static void set_user(const char *user)
@@ -1097,7 +1098,6 @@ static void set_root(const char *path)
10971098
#endif
10981099
}
10991100

1100-
11011101
static void server_init(void)
11021102
{
11031103
struct sockaddr_in IPaddr;
@@ -1248,6 +1248,7 @@ static void server_init(void)
12481248
DBUG_VOID_RETURN;
12491249
}
12501250

1251+
#endif /*!EMBEDDED_LIBRARY*/
12511252

12521253
void yyerror(const char *s)
12531254
{
@@ -2081,7 +2082,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
20812082
open_files_limit= 0; /* Can't set or detect limit */
20822083
#endif
20832084
unireg_init(opt_specialflag); /* Set up extern variabels */
2084-
init_errmessage(); /* Read error messages from file */
2085+
if (init_errmessage()) /* Read error messages from file */
2086+
return 1;
20852087
init_client_errs();
20862088
lex_init();
20872089
item_init();
@@ -2188,6 +2190,7 @@ static void init_ssl()
21882190

21892191
static int init_server_components()
21902192
{
2193+
DBUG_ENTER("init_server_components");
21912194
table_cache_init();
21922195
hostname_cache_init();
21932196
query_cache_result_size_limit(query_cache_limit);
@@ -2279,7 +2282,7 @@ Now disabling --log-slave-updates.");
22792282

22802283
init_max_user_conn();
22812284
init_update_queries();
2282-
return 0;
2285+
DBUG_RETURN(0);
22832286
}
22842287

22852288

@@ -5537,8 +5540,10 @@ static void get_options(int argc,char **argv)
55375540
/* Set global MyISAM variables from delay_key_write_options */
55385541
fix_delay_key_write((THD*) 0, OPT_GLOBAL);
55395542

5543+
#ifndef EMBEDDED_LIBRARY
55405544
if (mysqld_chroot)
55415545
set_root(mysqld_chroot);
5546+
#endif
55425547
fix_paths();
55435548

55445549
/*

0 commit comments

Comments
 (0)