List:Commits« Previous MessageNext Message »
From:jonas oreland Date:December 1 2010 1:36pm
Subject:bzr commit into mysql-5.1-telco-7.0 branch (jonas:4038)
View as plain text  
#At file:///home/jonas/src/telco-7.0/ based on revid:jonas@stripped

 4038 jonas oreland	2010-12-01
      ndb - fix rare bug with conflicting file-names for config-testing

    modified:
      storage/ndb/src/mgmsrv/testConfig.cpp
=== modified file 'storage/ndb/src/mgmsrv/testConfig.cpp'
--- a/storage/ndb/src/mgmsrv/testConfig.cpp	2010-11-28 11:34:01 +0000
+++ b/storage/ndb/src/mgmsrv/testConfig.cpp	2010-12-01 13:36:29 +0000
@@ -146,6 +146,23 @@ create_config(const char* first, ...)
 // Global variable for my_getopt
 extern "C" const char* my_defaults_file;
 
+#ifdef _WIN32
+#include <process.h>
+#else
+#include <unistd.h>
+#endif
+
+static
+unsigned
+pid()
+{
+#ifdef _WIN32
+  return (unsigned)_getpid();
+#else
+  return (unsigned)getpid();
+#endif
+}
+
 Config*
 create_mycnf(const char* first, ...)
 {
@@ -153,8 +170,8 @@ create_mycnf(const char* first, ...)
 
   NdbDir::Temp tempdir;
   BaseString mycnf_file;
-  mycnf_file.assfmt("%s%s%s",
-                    tempdir.path(), DIR_SEPARATOR, "test_my.cnf");
+  mycnf_file.assfmt("%s%stest_my.%u.cnf",
+                    tempdir.path(), DIR_SEPARATOR, pid());
 
   FILE* config_file= fopen(mycnf_file.c_str(), "w+");
   CHECK(config_file);
@@ -174,6 +191,7 @@ create_mycnf(const char* first, ...)
     printf("%s", buf);
 #endif
 
+  fflush(config_file);
   rewind(config_file);
 
   // Trick handle_options to read from the temp file


Attachment: [text/bzr-bundle] bzr/jonas@mysql.com-20101201133629-b2z4l4hi0nwy4gos.bundle
Thread
bzr commit into mysql-5.1-telco-7.0 branch (jonas:4038) jonas oreland1 Dec