--- mysql-5.0.89/sql/mysqld.cc.orig 2010-01-25 14:47:51 +0000 +++ mysql-5.0.89/sql/mysqld.cc 2010-01-25 14:50:21 +0000 @@ -137,6 +137,7 @@ #ifdef HAVE_SYS_MMAN_H #include #endif +#include // For tzset(3) #ifdef __WIN__ #include @@ -1477,12 +1478,19 @@ static void set_root(const char *path) { #if !defined(__WIN__) && !defined(__EMX__) && !defined(OS2) && !defined(__NETWARE__) + tzset(); + if (chroot(path) == -1) { sql_perror("chroot"); unireg_abort(1); } - my_setwd("/", MYF(0)); + + if (chdir("/") == -1) + { + sql_perror("chdir"); + unireg_abort(1); + } #endif } @@ -2958,8 +2966,6 @@ open_files_limit= files; } unireg_init(opt_specialflag); /* Set up extern variabels */ - if (init_errmessage()) /* Read error messages from file */ - return 1; init_client_errs(); lex_init(); item_init(); @@ -3763,6 +3769,8 @@ /* We have enough space for fiddling with the argv, continue */ + init_ssl(); + network_init(); check_data_home(mysql_real_data_home); if (my_setwd(mysql_real_data_home,MYF(MY_WME))) { @@ -3772,7 +3780,7 @@ mysql_data_home[0]=FN_CURLIB; // all paths are relative from here mysql_data_home[1]=0; - if ((user_info= check_user(mysqld_user))) + if (user_info) { #if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) if (locked_in_memory) // getuid() == 0 here @@ -3806,9 +3814,6 @@ if (init_server_components()) exit(1); - init_ssl(); - network_init(); - #ifdef __WIN__ if (!opt_console) { @@ -7726,7 +7731,7 @@ if (opt_help) { usage(); - exit(0); + exit(1); } #if defined(HAVE_BROKEN_REALPATH) my_use_symdir=0; @@ -7747,6 +7752,9 @@ } /* Set global MyISAM variables from delay_key_write_options */ fix_delay_key_write((THD*) 0, OPT_GLOBAL); + fix_paths(); + init_errmessage(); /* Read error messages from file */ + user_info = check_user(mysqld_user); #ifndef EMBEDDED_LIBRARY if (mysqld_chroot) @@ -7755,7 +7763,6 @@ max_allowed_packet= global_system_variables.max_allowed_packet; net_buffer_length= global_system_variables.net_buffer_length; #endif - fix_paths(); /* Set some global variables from the global_system_variables