List:Commits« Previous MessageNext Message »
From:Tatiana A. Nurnberg Date:July 21 2009 2:34pm
Subject:bzr commit into mysql-5.0-bugteam branch (azundris:2739) Bug#35132
View as plain text  
#At file:///Users/tnurnberg/forest/35132/50-35132/ based on revid:timothy.smith@stripped

 2739 Tatiana A. Nurnberg	2009-07-21
      Bug#35132: MySQLadmin --wait ping always crashes on Windows systems
      
      Failing to connect would release parts of the MYSQL struct.
      We would then proceed to try again to connect without re-
      initializing the struct.
      
      We prevent the unwanted freeing of data we'll still need now.
     @ client/mysqladmin.cc
        Losing a connect (or not even getting on in the first place) should
        not trash the MYSQL-struct.
     @ sql-common/client.c
        Assert against bad parameters usually caused by de-initing a
        MYSQL-struct without re-initing it again before re-use.

    modified:
      client/mysqladmin.cc
      sql-common/client.c
=== modified file 'client/mysqladmin.cc'
--- a/client/mysqladmin.cc	2007-09-13 14:19:46 +0000
+++ b/client/mysqladmin.cc	2009-07-21 14:34:22 +0000
@@ -22,6 +22,7 @@
 #endif
 #include <sys/stat.h>
 #include <mysql.h>
+#include <sql_common.h>
 
 #ifdef LATER_HAVE_NDBCLUSTER_DB
 #include "../ndb/src/mgmclient/ndb_mgmclient.h"
@@ -387,7 +388,14 @@ int main(int argc,char *argv[])
 	{
 	  if (option_wait && !interrupted)
 	  {
-	    mysql_close(&mysql);
+	    if (mysql.net.vio != 0)
+	    {
+		free_old_query(&mysql);
+		mysql.status=MYSQL_STATUS_READY; /* Force command */
+		mysql.reconnect=0;
+		simple_command(&mysql,COM_QUIT,NullS,0,1);
+		end_server(&mysql);		/* Sets mysql->net.vio= 0 */
+	    }
 	    if (!sql_connect(&mysql, option_wait))
 	    {
 	      sleep(1);				/* Don't retry too rapidly */
@@ -409,8 +417,8 @@ int main(int argc,char *argv[])
       else
 	break;
     }
-    mysql_close(&mysql);
   }
+  mysql_close(&mysql);
   my_free(opt_password,MYF(MY_ALLOW_ZERO_PTR));
   my_free(user,MYF(MY_ALLOW_ZERO_PTR));
 #ifdef HAVE_SMEM
@@ -436,7 +444,7 @@ static my_bool sql_connect(MYSQL *mysql,
   for (;;)
   {
     if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port,
-			   unix_port, 0))
+			   unix_port, CLIENT_REMEMBER_OPTIONS))
     {
       mysql->reconnect= 1;
       if (info)

=== modified file 'sql-common/client.c'
--- a/sql-common/client.c	2008-03-29 07:52:16 +0000
+++ b/sql-common/client.c	2009-07-21 14:34:22 +0000
@@ -414,6 +414,15 @@ HANDLE create_shared_memory(MYSQL *mysql
   char *shared_memory_base_name = mysql->options.shared_memory_base_name;
 
   /*
+    If this is NULL, somebody freed the MYSQL* options.  mysql_close()
+    is a good candidate.  We don't just silently (re)set it to
+    def_shared_memory_base_name as that would create really confusing/buggy
+    behavior if the user passed in a different name on the command-line or
+    in a my.cnf.
+  */
+  DBUG_ASSERT(shared_memory_base_name != NULL);
+
+  /*
      get enough space base-name + '_' + longest suffix we might ever send
    */
   if (!(tmp= (char *)my_malloc(strlen(shared_memory_base_name) + 32L, MYF(MY_FAE))))


Attachment: [text/bzr-bundle] bzr/azundris@mysql.com-20090721143422-ajum9hqwam8gqcps.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (azundris:2739) Bug#35132Tatiana A. Nurnberg21 Jul
  • Re: bzr commit into mysql-5.0-bugteam branch (azundris:2739) Bug#35132Davi Arnaut24 Jul
    • Re: bzr commit into mysql-5.0-bugteam branch (azundris:2739) Bug#35132Tatiana Azundris17 Aug
      • Re: bzr commit into mysql-5.0-bugteam branch (azundris:2739) Bug#35132Tatiana Azundris17 Aug