Commit 1bde86a0 authored by unknown's avatar unknown

Fixed core dump with long timezone names

Don't abort on bootstrap if a wrong --default-storage-engine is specified


sql/handler.cc:
  Combined code
sql/mysqld.cc:
  Fixed core dump with long timezone names
  Don't abort on bootstrap if a wrong --default-storage-engine is specified
  Don't print strange messages if one sends 'kill' to a mysqld --bootstrap
sql/set_var.cc:
  Indentaion change
parent 918c8edb
...@@ -163,13 +163,8 @@ my_bool ha_storage_engine_is_enabled(enum db_type database_type) ...@@ -163,13 +163,8 @@ my_bool ha_storage_engine_is_enabled(enum db_type database_type)
enum db_type ha_checktype(enum db_type database_type) enum db_type ha_checktype(enum db_type database_type)
{ {
show_table_type_st *types; if (ha_storage_engine_is_enabled(database_type))
for (types= sys_table_types; types->type; types++) return database_type;
{
if ((database_type == types->db_type) &&
(*types->value == SHOW_OPTION_YES))
return database_type;
}
switch (database_type) { switch (database_type) {
#ifndef NO_HASH #ifndef NO_HASH
......
...@@ -2426,8 +2426,10 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2426,8 +2426,10 @@ static int init_common_variables(const char *conf_file_name, int argc,
{ {
struct tm tm_tmp; struct tm tm_tmp;
localtime_r(&start_time,&tm_tmp); localtime_r(&start_time,&tm_tmp);
strmov(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]); strmake(system_time_zone, tzname[tm_tmp.tm_isdst != 0 ? 1 : 0],
} sizeof(system_time_zone)-1);
}
#endif #endif
/* /*
We set SYSTEM time zone as reasonable default and We set SYSTEM time zone as reasonable default and
...@@ -3081,7 +3083,8 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3081,7 +3083,8 @@ we force server id to 2, but this MySQL server will not act as a slave.");
if (opt_bootstrap) if (opt_bootstrap)
{ {
int error=bootstrap(stdin); select_thread_in_use= 0; // Allow 'kill' to work
int error= bootstrap(stdin);
end_thr_alarm(1); // Don't allow alarms end_thr_alarm(1); // Don't allow alarms
unireg_abort(error ? 1 : 0); unireg_abort(error ? 1 : 0);
} }
...@@ -6184,9 +6187,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -6184,9 +6187,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
case OPT_STORAGE_ENGINE: case OPT_STORAGE_ENGINE:
{ {
if ((enum db_type)((global_system_variables.table_type= if ((enum db_type)((global_system_variables.table_type=
ha_resolve_by_name(argument, strlen(argument)))) == DB_TYPE_UNKNOWN) ha_resolve_by_name(argument, strlen(argument)))) ==
DB_TYPE_UNKNOWN)
{ {
fprintf(stderr,"Unknown table type: %s\n",argument); fprintf(stderr,"Unknown/unsupported table type: %s\n",argument);
exit(1); exit(1);
} }
break; break;
...@@ -6442,10 +6446,14 @@ static void get_options(int argc,char **argv) ...@@ -6442,10 +6446,14 @@ static void get_options(int argc,char **argv)
if (!ha_storage_engine_is_enabled((enum db_type) if (!ha_storage_engine_is_enabled((enum db_type)
global_system_variables.table_type)) global_system_variables.table_type))
{ {
sql_print_error("Default storage engine (%s) is not available", if (!opt_bootstrap)
ha_get_storage_engine((enum db_type) {
global_system_variables.table_type)); sql_print_error("Default storage engine (%s) is not available",
exit(1); ha_get_storage_engine((enum db_type)
global_system_variables.table_type));
exit(1);
}
global_system_variables.table_type= DB_TYPE_MYISAM;
} }
if (argc > 0) if (argc > 0)
......
...@@ -2985,8 +2985,8 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var) ...@@ -2985,8 +2985,8 @@ bool sys_var_thd_storage_engine::check(THD *thd, set_var *var)
enum db_type db_type; enum db_type db_type;
if (!(res=var->value->val_str(&str)) || if (!(res=var->value->val_str(&str)) ||
!(var->save_result.ulong_value= !(var->save_result.ulong_value=
(ulong) (db_type= ha_resolve_by_name(res->ptr(), res->length()))) || (ulong) (db_type= ha_resolve_by_name(res->ptr(), res->length()))) ||
ha_checktype(db_type) != db_type) ha_checktype(db_type) != db_type)
{ {
value= res ? res->c_ptr() : "NULL"; value= res ? res->c_ptr() : "NULL";
goto err; goto err;
......
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