Commits

Anonymous committed 6af8e3e

COMP: Use tempnam, not _tempnam. And tempnam returns a malloc'ed pointer, so free it.

Comments (0)

Files changed (1)

GCC_XML/GXFront/gxConfiguration.cxx

   // Write a temp file such that after preprocessing there should only be
   // one "<Id>(.*)</Id>" chunk in the output.
   //
-  std::string cppFile = _tempnam(0, "gx");
+  std::string cppFile;
+  const char* cppFileBase = tempnam(0, "gx");
+  if(cppFileBase)
+    {
+    cppFile = cppFileBase;
+    free((void*) cppFileBase);
+    }
+  else
+    {
+    cppFile = "gx1";
+    }
   cppFile += ".cpp";
 
   std::ofstream ofs(cppFile.c_str());