List:Internals« Previous MessageNext Message »
From:Geoffroy Cogniaux Date:April 22 2007 9:28am
Subject:[Patch] proposed patch for Bug #28012 : IM crashes instead of reporting an error when mysqldpath is bad
View as plain text  
Hi,

Below is a patch for the bug <http://bugs.mysqsl.com/28012>.

I added some comments to explain my choices into the patch that can be
removed if necessary.
I will be pleased to receive your feedback.

Regards,
Geoffroy.



---
J:\_devel\bk-client2.0\mysql-5.1\server-tools\instance-manager\instance.cc
2007-02-23 12:13:48.000000000 +0100
+++
J:\_devel\_MySQL\src\mysql-5.1-tree\server-tools\instance-manager\instance.c
c	2007-04-22 10:18:13.863500000 +0200
@@ -155,6 +155,9 @@
 static bool start_process(Instance_options *instance_options,
                           My_process_info *pi)
 {
+  if(!instance_options->argv[0])/* cmdline will be NULL */
+    return TRUE;
+
   STARTUPINFO si;
 
   ZeroMemory(&si, sizeof(STARTUPINFO));
@@ -345,6 +348,9 @@
     instance->lock();
     instance->monitoring_thread_active= FALSE;
     instance->unlock();
+    /* report the error */
+    log_error("Instance '%s': Monitor: starting mysqld failed.",
+             (const char *) instance->get_name()->str);
 
     return;
   }
---
J:\_devel\bk-client2.0\mysql-5.1\server-tools\instance-manager\instance_opti
ons.cc	2007-03-06 16:55:01.000000000 +0100
+++
J:\_devel\_MySQL\src\mysql-5.1-tree\server-tools\instance-manager\instance_o
ptions.cc	2007-04-22 10:22:19.113500000 +0200
@@ -544,15 +544,16 @@
     set_option(&option);
   }
 
-  if (get_pid_filename(pid_file_with_path))
-    return TRUE;
-
   /* we need to reserve space for the final zero + possible default options
*/
   if (!(argv= (char**)
         alloc_root(&alloc, (get_num_options() + 1
                             + MAX_NUMBER_OF_DEFAULT_OPTIONS) *
sizeof(char*))))
     return TRUE;
   filled_default_options= 0;
+  argv[0]=NULL; /* initialize to avoid crash in case of bad mysqld path */
+
+  if (get_pid_filename(pid_file_with_path))
+    return TRUE;
 
   /* the path must be first in the argv */
   if (add_to_argv(mysqld_path.str))




Thread
[Patch] proposed patch for Bug #28012 : IM crashes instead of reporting an error when mysqldpath is badGeoffroy Cogniaux22 Apr