--- mysql-5.0.18/sql/mysqld.cc.orig 2005-12-21 22:39:30 +0300 +++ mysql-5.0.18/sql/mysqld.cc 2006-02-07 16:30:34 +0300 @@ -134,6 +134,7 @@ int deny_severity = LOG_WARNING; #ifdef HAVE_SYS_MMAN_H #include #endif +#include // For tzset(3) #ifdef __NETWARE__ #define zVOLSTATE_ACTIVE 6 @@ -1341,12 +1342,19 @@ static void set_effective_user(struct pa 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 } @@ -2613,8 +2621,6 @@ static int init_common_variables(const c 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(); @@ -3313,6 +3319,7 @@ int main(int argc, char **argv) /* We have enough space for fiddling with the argv, continue */ + network_init(); check_data_home(mysql_real_data_home); if (my_setwd(mysql_real_data_home,MYF(MY_WME))) { @@ -3322,7 +3329,7 @@ int main(int argc, char **argv) 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 @@ -3356,8 +3363,6 @@ we force server id to 2, but this MySQL if (init_server_components()) exit(1); - network_init(); - #ifdef __WIN__ if (!opt_console) { @@ -7051,7 +7056,7 @@ static void get_options(int argc,char ** if (opt_help) { usage(); - exit(0); + exit(1); } #if defined(HAVE_BROKEN_REALPATH) my_use_symdir=0; @@ -7072,6 +7077,9 @@ static void get_options(int argc,char ** } /* 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) @@ -7080,7 +7088,6 @@ static void get_options(int argc,char ** 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