Commit c42abd80 authored by unknown's avatar unknown

Fix for Windows bug reported throuhg Miguel


libmysqld/lib_sql.cc:
  This code seems to be superfluous
sql/derror.cc:
  in embedded server these functions should return the sign of the error
  instead of halting the program
sql/init.cc:
  my_abort_hook left unchanged
sql/mysql_priv.h:
  declaration of init_errmessage changed
  unireg_abort was replaced with DBUG_RETURN for embedded server
sql/mysqld.cc:
  these functions don't work in embedded server thus #ifdef-ed
parent 7cb7f7b8
...@@ -435,11 +435,6 @@ void STDCALL mysql_server_end() ...@@ -435,11 +435,6 @@ void STDCALL mysql_server_end()
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
copy_arguments_ptr=0; copy_arguments_ptr=0;
clean_up(0); clean_up(0);
#ifdef THREAD
/* Don't call my_thread_end() if the application is using MY_INIT() */
if (!org_my_init_done)
my_thread_end();
#endif
/* If library called my_init(), free memory allocated by it */ /* If library called my_init(), free memory allocated by it */
if (!org_my_init_done) if (!org_my_init_done)
my_end(0); my_end(0);
......
...@@ -20,27 +20,28 @@ ...@@ -20,27 +20,28 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
static void read_texts(const char *file_name,const char ***point, static bool read_texts(const char *file_name,const char ***point,
uint error_messages); uint error_messages);
static void init_myfunc_errs(void); static void init_myfunc_errs(void);
/* Read messages from errorfile */ /* Read messages from errorfile */
void init_errmessage(void) bool init_errmessage(void)
{ {
DBUG_ENTER("init_errmessage"); DBUG_ENTER("init_errmessage");
read_texts(ERRMSG_FILE,&my_errmsg[ERRMAPP],ER_ERROR_MESSAGES); if (read_texts(ERRMSG_FILE,&my_errmsg[ERRMAPP],ER_ERROR_MESSAGES))
DBUG_RETURN(TRUE);
errmesg=my_errmsg[ERRMAPP]; /* Init global variabel */ errmesg=my_errmsg[ERRMAPP]; /* Init global variabel */
init_myfunc_errs(); /* Init myfunc messages */ init_myfunc_errs(); /* Init myfunc messages */
DBUG_VOID_RETURN; DBUG_RETURN(FALSE);
} }
/* Read text from packed textfile in language-directory */ /* Read text from packed textfile in language-directory */
/* If we can't read messagefile then it's panic- we can't continue */ /* If we can't read messagefile then it's panic- we can't continue */
static void read_texts(const char *file_name,const char ***point, static bool read_texts(const char *file_name,const char ***point,
uint error_messages) uint error_messages)
{ {
register uint i; register uint i;
...@@ -116,7 +117,7 @@ Check that the above file is the right version for this program!", ...@@ -116,7 +117,7 @@ Check that the above file is the right version for this program!",
point[i]= *point +uint2korr(head+10+i+i); point[i]= *point +uint2korr(head+10+i+i);
} }
VOID(my_close(file,MYF(0))); VOID(my_close(file,MYF(0)));
DBUG_VOID_RETURN; DBUG_RETURN(FALSE);
err: err:
switch (funktpos) { switch (funktpos) {
......
...@@ -37,7 +37,9 @@ void unireg_init(ulong options) ...@@ -37,7 +37,9 @@ void unireg_init(ulong options)
#ifdef USE_MY_ATOF #ifdef USE_MY_ATOF
init_my_atof(); /* use our atof */ init_my_atof(); /* use our atof */
#endif #endif
#ifndef EMBEDDED_LIBRARY
my_abort_hook=unireg_abort; /* Abort with close of databases */ my_abort_hook=unireg_abort; /* Abort with close of databases */
#endif
VOID(strmov(reg_ext,".frm")); VOID(strmov(reg_ext,".frm"));
for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS
......
...@@ -725,7 +725,7 @@ void key_restore(TABLE *form,byte *key,uint index,uint key_length); ...@@ -725,7 +725,7 @@ void key_restore(TABLE *form,byte *key,uint index,uint key_length);
int key_cmp(TABLE *form,const byte *key,uint index,uint key_length); int key_cmp(TABLE *form,const byte *key,uint index,uint key_length);
void key_unpack(String *to,TABLE *form,uint index); void key_unpack(String *to,TABLE *form,uint index);
bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields); bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields);
void init_errmessage(void); bool init_errmessage(void);
void sql_perror(const char *message); void sql_perror(const char *message);
void sql_print_error(const char *format,...) void sql_print_error(const char *format,...)
...@@ -919,7 +919,11 @@ void calc_time_from_sec(TIME *to, long seconds, long microseconds); ...@@ -919,7 +919,11 @@ void calc_time_from_sec(TIME *to, long seconds, long microseconds);
int test_if_number(char *str,int *res,bool allow_wildcards); int test_if_number(char *str,int *res,bool allow_wildcards);
void change_byte(byte *,uint,char,char); void change_byte(byte *,uint,char,char);
#ifndef EMBEDDED_LIBRARY
extern "C" void unireg_abort(int exit_code); extern "C" void unireg_abort(int exit_code);
#else
#define unireg_abort(exit_code) DBUG_RETURN(exit_code)
#endif
void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
SQL_SELECT *select, SQL_SELECT *select,
int use_record_cache, bool print_errors); int use_record_cache, bool print_errors);
......
...@@ -845,6 +845,7 @@ extern "C" sig_handler print_signal_warning(int sig) ...@@ -845,6 +845,7 @@ extern "C" sig_handler print_signal_warning(int sig)
(Mac OS X) we have to call exit() instead if pthread_exit(). (Mac OS X) we have to call exit() instead if pthread_exit().
*/ */
#ifndef EMBEDDED_LIBRARY
void unireg_end(void) void unireg_end(void)
{ {
clean_up(1); clean_up(1);
...@@ -856,7 +857,6 @@ void unireg_end(void) ...@@ -856,7 +857,6 @@ void unireg_end(void)
#endif #endif
} }
extern "C" void unireg_abort(int exit_code) extern "C" void unireg_abort(int exit_code)
{ {
DBUG_ENTER("unireg_abort"); DBUG_ENTER("unireg_abort");
...@@ -868,7 +868,7 @@ extern "C" void unireg_abort(int exit_code) ...@@ -868,7 +868,7 @@ extern "C" void unireg_abort(int exit_code)
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0); my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(exit_code); /* purecov: inspected */ exit(exit_code); /* purecov: inspected */
} }
#endif
void clean_up(bool print_message) void clean_up(bool print_message)
{ {
...@@ -1015,6 +1015,7 @@ static void set_ports() ...@@ -1015,6 +1015,7 @@ static void set_ports()
} }
} }
#ifndef EMBEDDED_LIBRARY
/* Change to run as another user if started with --user */ /* Change to run as another user if started with --user */
static void set_user(const char *user) static void set_user(const char *user)
...@@ -1097,7 +1098,6 @@ static void set_root(const char *path) ...@@ -1097,7 +1098,6 @@ static void set_root(const char *path)
#endif #endif
} }
static void server_init(void) static void server_init(void)
{ {
struct sockaddr_in IPaddr; struct sockaddr_in IPaddr;
...@@ -1248,6 +1248,7 @@ static void server_init(void) ...@@ -1248,6 +1248,7 @@ static void server_init(void)
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#endif /*!EMBEDDED_LIBRARY*/
void yyerror(const char *s) void yyerror(const char *s)
{ {
...@@ -2081,7 +2082,8 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2081,7 +2082,8 @@ static int init_common_variables(const char *conf_file_name, int argc,
open_files_limit= 0; /* Can't set or detect limit */ open_files_limit= 0; /* Can't set or detect limit */
#endif #endif
unireg_init(opt_specialflag); /* Set up extern variabels */ unireg_init(opt_specialflag); /* Set up extern variabels */
init_errmessage(); /* Read error messages from file */ if (init_errmessage()) /* Read error messages from file */
return 1;
init_client_errs(); init_client_errs();
lex_init(); lex_init();
item_init(); item_init();
...@@ -2188,6 +2190,7 @@ static void init_ssl() ...@@ -2188,6 +2190,7 @@ static void init_ssl()
static int init_server_components() static int init_server_components()
{ {
DBUG_ENTER("init_server_components");
table_cache_init(); table_cache_init();
hostname_cache_init(); hostname_cache_init();
query_cache_result_size_limit(query_cache_limit); query_cache_result_size_limit(query_cache_limit);
...@@ -2279,7 +2282,7 @@ Now disabling --log-slave-updates."); ...@@ -2279,7 +2282,7 @@ Now disabling --log-slave-updates.");
init_max_user_conn(); init_max_user_conn();
init_update_queries(); init_update_queries();
return 0; DBUG_RETURN(0);
} }
...@@ -5537,8 +5540,10 @@ static void get_options(int argc,char **argv) ...@@ -5537,8 +5540,10 @@ static void get_options(int argc,char **argv)
/* Set global MyISAM variables from delay_key_write_options */ /* Set global MyISAM variables from delay_key_write_options */
fix_delay_key_write((THD*) 0, OPT_GLOBAL); fix_delay_key_write((THD*) 0, OPT_GLOBAL);
#ifndef EMBEDDED_LIBRARY
if (mysqld_chroot) if (mysqld_chroot)
set_root(mysqld_chroot); set_root(mysqld_chroot);
#endif
fix_paths(); fix_paths();
/* /*
......
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