summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmysqld/lib_sql.cc5
-rw-r--r--sql/derror.cc13
-rw-r--r--sql/init.cc2
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/mysqld.cc15
5 files changed, 24 insertions, 17 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index c9f98a701ef..d4cb916a89c 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -435,11 +435,6 @@ void STDCALL mysql_server_end()
my_free((char*) copy_arguments_ptr, MYF(MY_ALLOW_ZERO_PTR));
copy_arguments_ptr=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 (!org_my_init_done)
my_end(0);
diff --git a/sql/derror.cc b/sql/derror.cc
index 78efdcc33f3..7f4068c487e 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -20,27 +20,28 @@
#include "mysql_priv.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);
static void init_myfunc_errs(void);
/* Read messages from errorfile */
-void init_errmessage(void)
+bool init_errmessage(void)
{
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 */
init_myfunc_errs(); /* Init myfunc messages */
- DBUG_VOID_RETURN;
+ DBUG_RETURN(FALSE);
}
/* Read text from packed textfile in language-directory */
/* 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)
{
register uint i;
@@ -116,7 +117,7 @@ Check that the above file is the right version for this program!",
point[i]= *point +uint2korr(head+10+i+i);
}
VOID(my_close(file,MYF(0)));
- DBUG_VOID_RETURN;
+ DBUG_RETURN(FALSE);
err:
switch (funktpos) {
diff --git a/sql/init.cc b/sql/init.cc
index 50d504068a0..8b15fef4ee3 100644
--- a/sql/init.cc
+++ b/sql/init.cc
@@ -37,7 +37,9 @@ void unireg_init(ulong options)
#ifdef USE_MY_ATOF
init_my_atof(); /* use our atof */
#endif
+#ifndef EMBEDDED_LIBRARY
my_abort_hook=unireg_abort; /* Abort with close of databases */
+#endif
VOID(strmov(reg_ext,".frm"));
for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 6c1f7bfa472..f30702afcc2 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -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);
void key_unpack(String *to,TABLE *form,uint index);
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_print_error(const char *format,...)
@@ -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);
void change_byte(byte *,uint,char,char);
+#ifndef EMBEDDED_LIBRARY
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,
SQL_SELECT *select,
int use_record_cache, bool print_errors);
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 812a5b28ff7..d2c04f634f9 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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().
*/
+#ifndef EMBEDDED_LIBRARY
void unireg_end(void)
{
clean_up(1);
@@ -856,7 +857,6 @@ void unireg_end(void)
#endif
}
-
extern "C" void unireg_abort(int exit_code)
{
DBUG_ENTER("unireg_abort");
@@ -868,7 +868,7 @@ extern "C" void unireg_abort(int exit_code)
my_end(opt_endinfo ? MY_CHECK_ERROR | MY_GIVE_INFO : 0);
exit(exit_code); /* purecov: inspected */
}
-
+#endif
void clean_up(bool print_message)
{
@@ -1015,6 +1015,7 @@ static void set_ports()
}
}
+#ifndef EMBEDDED_LIBRARY
/* Change to run as another user if started with --user */
static void set_user(const char *user)
@@ -1097,7 +1098,6 @@ static void set_root(const char *path)
#endif
}
-
static void server_init(void)
{
struct sockaddr_in IPaddr;
@@ -1248,6 +1248,7 @@ static void server_init(void)
DBUG_VOID_RETURN;
}
+#endif /*!EMBEDDED_LIBRARY*/
void yyerror(const char *s)
{
@@ -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 */
#endif
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();
lex_init();
item_init();
@@ -2188,6 +2190,7 @@ static void init_ssl()
static int init_server_components()
{
+ DBUG_ENTER("init_server_components");
table_cache_init();
hostname_cache_init();
query_cache_result_size_limit(query_cache_limit);
@@ -2279,7 +2282,7 @@ Now disabling --log-slave-updates.");
init_max_user_conn();
init_update_queries();
- return 0;
+ DBUG_RETURN(0);
}
@@ -5537,8 +5540,10 @@ static void get_options(int argc,char **argv)
/* Set global MyISAM variables from delay_key_write_options */
fix_delay_key_write((THD*) 0, OPT_GLOBAL);
+#ifndef EMBEDDED_LIBRARY
if (mysqld_chroot)
set_root(mysqld_chroot);
+#endif
fix_paths();
/*