There are a few files that this affects.

tests/src/file.cpp
src/file.cpp
util/memchk.cpp

tests/src/file.cpp change is listed: 

Index: file.cpp
===================================================================
--- file.cpp    (revision 634377)
+++ file.cpp    (working copy)
@@ -205,8 +205,15 @@
 #ifndef _RWSTD_NO_MKSTEMP
 #  define TMP_TEMPLATE      "tmpfile-XXXXXX"
 
+    char* tmpdir = getenv("TMPDIR");
+
+    if (NULL == tmpdir)
+    {
+        tmpdir = P_tmpdir;
+    }
+
     if (!buf) {
-        static char fname_buf [sizeof (P_tmpdir) + sizeof
(TMP_TEMPLATE)];
+        static char fname_buf [sizeof (tmpdir) + sizeof
(TMP_TEMPLATE)];
 
         buf = fname_buf;
         *buf = '\0';
@@ -214,13 +221,13 @@
 
     if ('\0' == *buf) {
         // copy the template to the buffer; make sure there is exactly
-        // one path separator character between P_tmpdir and the file
+        // one path separator character between tmpdir and the file
         // name template (it doesn't really matter how many there are
         // as long as it's at least one, but one looks better than two
         // in diagnostic messages)
-        size_t len = sizeof (P_tmpdir) - 1;
+        size_t len = sizeof (tmpdir) - 1;
 
-        memcpy (buf, P_tmpdir, len);
+        memcpy (buf, tmpdir, len);
         if (_RWSTD_PATH_SEP != buf [len - 1])
             buf [len++] = _RWSTD_PATH_SEP;
 
@@ -248,7 +255,7 @@
 #  if defined (_WIN32) || defined (_WIN64)
 
     // create a temporary file name
-    char* fname = tempnam (P_tmpdir, ".rwtest-tmp");
+    char* fname = tempnam (tmpdir, ".rwtest-tmp");
 
     if (fname) {
 
@@ -269,7 +276,7 @@
     else {
         fprintf (stderr, "%s:%d: tempnam(\"%s\", \"%s\") failed: %s\n",
                  __FILE__, __LINE__,
-                 P_tmpdir, ".rwtest-tmp", strerror (errno));
+                 tmpdir, ".rwtest-tmp", strerror (errno));
     }
 
 #  else

Reply via email to