List:Internals« Previous MessageNext Message »
From:Armin Schöffmann Date:June 5 2007 1:29pm
Subject:[PATCH] Proposed patch for bug #28774, #28606
View as plain text  
Hello everyone,

http://bugs.mysql.com/bug.php?id=28606
http://bugs.mysql.com/bug.php?id=28774

Tested against current bk-sourcetree and 5.0.42 enterprise commercial with win vista x64 and win2k sp4.

hope you find it useful...
Armin.

--
Aegaeon technologies GmbH
phone: +49.941.8107344
fax:   +49.941.8107356 

Legal disclaimer:
http://aegaeon.de/disclaimer/email_all_int.txt

--- 5.0repos/client/mysql_upgrade.c	2007-04-23 13:27:54.000000000 +0200
+++ mysql-5.0/client/mysql_upgrade.c	2007-06-05 14:52:01.145690500 +0200
@@ -436,13 +436,21 @@
   DBUG_ENTER("run_query");
   DBUG_PRINT("enter", ("query: %s", query));
   if ((fd= create_temp_file(query_file_path, NULL,
-                            "sql", O_CREAT | O_SHARE | O_RDWR,
+                            "sql", O_CREAT | O_SHARE | O_RDWR | _O_SHORT_LIVED,
                             MYF(MY_WME))) < 0)
-    die("Failed to create temporary file for defaults");
+   {
+	my_close(fd, MYF(0));
+	my_delete(fd, MYF(0));
+	die("Failed to write to '%s'", query_file_path);
+  }
 
   if (my_write(fd, query, strlen(query),
                MYF(MY_FNABP | MY_WME)))
-    die("Failed to write to '%s'", query_file_path);
+  {
+	my_close(fd, MYF(0));
+	my_delete(fd, MYF(0));
+	die("Failed to write to '%s'", query_file_path);
+  }
 
   ret= run_tool(mysql_path,
                 ds_res,
@@ -457,6 +465,7 @@
                 NULL);
 
   my_close(fd, MYF(0));
+  my_delete(fd, MYF(0));
 
   DBUG_RETURN(ret);
 }
--- 5.0repos/mysys/mf_tempfile.c	2007-03-23 11:01:46.000000000 +0100
+++ mysql-5.0/mysys/mf_tempfile.c	2007-06-05 14:46:24.214130500 +0200
@@ -59,6 +59,8 @@
 		      myf MyFlags __attribute__((unused)))
 {
   File file= -1;
+  char *sztmpdir;
+  MY_TMPDIR tmpdir;
 
   DBUG_ENTER("create_temp_file");
   DBUG_PRINT("enter", ("dir: %s, prefix: %s", dir, prefix));
@@ -69,8 +71,21 @@
      the file and release it's handle
       - uses up to the first three letters from prefix
    */
+  sztmpdir= 0;
+  if(!dir)
+  {
+	init_tmpdir(&tmpdir,0);
+	sztmpdir=my_tmpdir(&tmpdir);
+	dir=sztmpdir;
+  }
   if (GetTempFileName(dir, prefix, 0, to) == 0)
-    DBUG_RETURN(-1);
+  {
+	  if(sztmpdir)
+		free_tmpdir(&tmpdir);
+     DBUG_RETURN(-1);
+  }
+  if(sztmpdir)
+	free_tmpdir(&tmpdir);
 
   DBUG_PRINT("info", ("name: %s", to));
 
Thread
[PATCH] Proposed patch for bug #28774, #28606Armin Schöffmann5 Jun
  • RE: [PATCH] Proposed patch for bug #28774, #28606Armin Schöffmann5 Jun