summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@mysql.com>2008-11-19 13:57:23 +0400
committerAlexey Botchkov <holyfoot@mysql.com>2008-11-19 13:57:23 +0400
commit70e8a4fd544984c3b7792d2428d16e0f4a244076 (patch)
tree071816ae207f688b1ce7cd2f417f46f05d90aad8 /sql
parent749f8b3ec1fe144a5f510ecb2e9ab9b198185755 (diff)
downloadmariadb-git-70e8a4fd544984c3b7792d2428d16e0f4a244076.tar.gz
Bug#38293 Libmysqld crash in mysql_library_init if language file missing
That's a Win-specific error. When we create libmysqld.dll we have many libraries like mysys, dbug, strings, etc linked into that dll, so the application built upon this library shouldn't link these libraries to itself, rather use those inside the dll. Fixed by redirecting calls into the libmysqld.dll per-file comments: dbug/dbug.c Bug#38293 Libmysqld crash in mysql_library_init if language file missing fake _db_something definitions added include/my_dbug.h Bug#38293 Libmysqld crash in mysql_library_init if language file missing fake _db_something declarations added libmysqld/examples/CMakeLists.txt Bug#38293 Libmysqld crash in mysql_library_init if language file missing superfluous libraries removed from linking libmysqld/libmysqld.def Bug#38293 Libmysqld crash in mysql_library_init if language file missing set of mysys functions added to the export section
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc31
1 files changed, 20 insertions, 11 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index a3b0123ee4a..99583ca8ea9 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -733,7 +733,7 @@ uint connection_count= 0;
/* Function declarations */
pthread_handler_t signal_hand(void *arg);
-static void mysql_init_variables(void);
+static int mysql_init_variables(void);
static void get_options(int *argc,char **argv);
extern "C" my_bool mysqld_get_one_option(int, const struct my_option *, char *);
static void set_server_version(void);
@@ -3131,12 +3131,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
if (!rpl_filter || !binlog_filter)
{
sql_perror("Could not allocate replication and binlog filters");
- exit(1);
+ return 1;
}
- if (init_thread_environment())
+ if (init_thread_environment() ||
+ mysql_init_variables())
return 1;
- mysql_init_variables();
#ifdef HAVE_TZNAME
{
@@ -3735,7 +3735,10 @@ version 5.0 and above. It is replaced by the binary log.");
{
/* as opt_bin_log==0, no need to free opt_bin_logname */
if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME))))
- exit(EXIT_OUT_OF_MEMORY);
+ {
+ sql_print_error("Out of memory");
+ return EXIT_OUT_OF_MEMORY;
+ }
sql_print_error("The update log is no longer supported by MySQL in \
version 5.0 and above. It is replaced by the binary log. Now starting MySQL \
with --log-bin='%s' instead.",opt_bin_logname);
@@ -7404,7 +7407,7 @@ To see what values a running MySQL server is using, type\n\
as these are initialized by my_getopt.
*/
-static void mysql_init_variables(void)
+static int mysql_init_variables(void)
{
/* Things reset to zero */
opt_skip_slave_start= opt_reckless_slave = 0;
@@ -7485,7 +7488,10 @@ static void mysql_init_variables(void)
key_caches.empty();
if (!(dflt_key_cache= get_or_create_key_cache(default_key_cache_base.str,
default_key_cache_base.length)))
- exit(1);
+ {
+ sql_print_error("Cannot allocate the keycache");
+ return 1;
+ }
/* set key_cache_hash.default_value = dflt_key_cache */
multi_keycache_init();
@@ -7628,6 +7634,7 @@ static void mysql_init_variables(void)
tmpenv = DEFAULT_MYSQL_HOME;
(void) strmake(mysql_home, tmpenv, sizeof(mysql_home)-1);
#endif
+ return 0;
}
@@ -7687,9 +7694,11 @@ mysqld_get_one_option(int optid,
#endif
break;
#include <sslopt-case.h>
+#ifndef EMBEDDED_LIBRARY
case 'V':
print_version();
exit(0);
+#endif /*EMBEDDED_LIBRARY*/
case 'W':
if (!argument)
global_system_variables.log_warnings++;
@@ -7914,14 +7923,14 @@ mysqld_get_one_option(int optid,
if (gethostname(myhostname,sizeof(myhostname)) < 0)
{
sql_perror("Can't start server: cannot get my own hostname!");
- exit(1);
+ return 1;
}
ent=gethostbyname(myhostname);
}
if (!ent)
{
sql_perror("Can't start server: cannot resolve hostname!");
- exit(1);
+ return 1;
}
my_bind_addr = (ulong) ((in_addr*)ent->h_addr_list[0])->s_addr;
}
@@ -8118,8 +8127,8 @@ mysqld_get_one_option(int optid,
case OPT_FT_BOOLEAN_SYNTAX:
if (ft_boolean_check_syntax_string((uchar*) argument))
{
- fprintf(stderr, "Invalid ft-boolean-syntax string: %s\n", argument);
- exit(1);
+ sql_print_error("Invalid ft-boolean-syntax string: %s\n", argument);
+ return 1;
}
strmake(ft_boolean_syntax, argument, sizeof(ft_boolean_syntax)-1);
break;