--- orig/sql/mysqld.cc 2009-01-13 05:05:01.000000000 -0800 +++ pid_hack/sql/mysqld.cc 2009-12-06 18:49:44.000000000 -0800 @@ -1959,13 +1959,6 @@ SetUnhandledExceptionFilter(my_unhandler_exception_filter); } -static void start_signal_handler(void) -{ - // Save vm id of this process - if (!opt_bootstrap) - create_pid_file(); -} - static void check_data_home(const char *path) {} @@ -2186,16 +2179,6 @@ } - -static void start_signal_handler(void) -{ - // Save vm id of this process - if (!opt_bootstrap) - create_pid_file(); - // no signal handler -} - - /* Warn if the data is on a Traditional volume @@ -2238,10 +2221,6 @@ signal_thread = pthread_self(); } - -static void start_signal_handler(void) -{} - static void check_data_home(const char *path) {} #endif /*__WIN__ || __NETWARE || __EMX__*/ @@ -2541,10 +2520,6 @@ (void) sigaddset(&set,SIGTERM); (void) sigaddset(&set,SIGTSTP); - /* Save pid to this process (or thread on Linux) */ - if (!opt_bootstrap) - create_pid_file(); - #ifdef HAVE_STACK_TRACE_ON_SEGV if (opt_do_pstack) { @@ -3624,6 +3599,7 @@ MY_INIT(argv[0]); // init my_sys library & pthreads /* ^^^ Nothing should be before this line! */ + /* Set signal used to kill MySQL */ #if defined(SIGUSR2) thr_kill_signal= thd_lib_detected == THD_LIB_LT ? SIGINT : SIGUSR2; @@ -3659,6 +3635,11 @@ argc, argv, load_default_groups)) unireg_abort(1); // Will do exit +#if !defined(EMBEDDED_LIBRARY) && !defined(__EMX__) + if (!opt_bootstrap) + create_pid_file(); +#endif + init_signals(); if (!(opt_specialflag & SPECIAL_NO_PRIOR)) my_pthread_setprio(pthread_self(),CONNECT_PRIOR); @@ -3733,6 +3714,7 @@ } + if (opt_bin_log && !server_id) { server_id= !master_host ? 1 : 2; @@ -3778,7 +3760,11 @@ After this we can't quit by a simple unireg_abort */ error_handler_hook= my_message_sql; - start_signal_handler(); // Creates pidfile + +#if !defined(__WIN__) && !defined(__NETWARE__) && !defined(__EMX__) + start_signal_handler(); +#endif + if (mysql_rm_tmp_tables() || acl_init(opt_noacl) || my_tz_init((THD *)0, default_tz_name, opt_bootstrap)) {