dbus/dbus-sysdeps-win.c: use GetTempPath, not getenv, in _dbus_get_tmpdir (cherry...
authorTor Lillqvist <tml@iki.fi>
Wed, 22 Apr 2009 11:27:44 +0000 (13:27 +0200)
committerRalf Habacker <ralf.habacker@freenet.de>
Mon, 30 Nov 2009 12:21:32 +0000 (13:21 +0100)
dbus/dbus-sysdeps-win.c

index 9a29a39..2aec554 100644 (file)
@@ -2388,17 +2388,14 @@ const char*
 _dbus_get_tmpdir(void)
 {
   static const char* tmpdir = NULL;
+  static char buf[1000];
 
   if (tmpdir == NULL)
     {
-      if (tmpdir == NULL)
-        tmpdir = getenv("TMP");
-      if (tmpdir == NULL)
-        tmpdir = getenv("TEMP");
-      if (tmpdir == NULL)
-        tmpdir = getenv("TMPDIR");
-      if (tmpdir == NULL)
-          tmpdir = "C:\\Temp";
+      if (!GetTempPath (sizeof (buf), buf))
+        strcpy (buf, "\\");
+
+      tmpdir = buf;
     }
 
   _dbus_assert(tmpdir != NULL);