]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-windows-temp-path-20070416
authorJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 17 Apr 2007 01:06:25 +0000 (01:06 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 17 Apr 2007 01:06:25 +0000 (01:06 +0000)
Use GetTempPath() instead of testing environment variables ourselves.

(cherry picked from commit 44ca92226ae8e780b6c6134c83b08b3c8c266c95)

src/WINNT/afsd/afsd_init.c

index afbb2ca331869bf32d1904ec02535cbb110974e5..cf7e07308b2ad04c4621f403d2ac69d427ada3ee 100644 (file)
@@ -136,7 +136,7 @@ void afsd_initUpperCaseTable()
 void
 afsi_start()
 {
-    char wd[256];
+    char wd[MAX_PATH+1];
     char t[100], u[100], *p, *path;
     int zilch;
     DWORD code;
@@ -146,13 +146,10 @@ afsi_start()
     DWORD maxLogSize = 100 * 1024;
 
     afsi_file = INVALID_HANDLE_VALUE;
-    code = GetEnvironmentVariable("TEMP", wd, sizeof(wd));
-    if ( code == 0 || code > sizeof(wd) )
-    {
-        code = GetWindowsDirectory(wd, sizeof(wd));
-        if (code == 0) 
-            return;
-    }
+    code = GetTempPath(sizeof(wd)-15, wd);
+    if ( code == 0 || code > (sizeof(wd)-15) )
+        return;         /* unable to create a log */
+
     StringCbCatA(wd, sizeof(wd), "\\afsd_init.log");
     GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, NULL, NULL, t, sizeof(t));
     afsi_file = CreateFile(wd, GENERIC_WRITE, FILE_SHARE_READ, NULL,