msvcrt: checking TMP in _tempnam

Sasha Slijepcevic sascha93101 at yahoo.com
Tue Jan 17 21:16:21 CST 2006


Hi,
this is a bug fix for
http://bugs.winehq.org/show_bug.cgi?id=4335.

Sasha Slijepcevic
sascha93101 ,at, yahoo.com
 
Change Log:
  In _tempnam in native code, if the environment
  variable TMP is set, it has a precedence over the
  parameter dir. This patch makes _tempnam in msvcrt
  comply with the native code behavior.

===============================================================
--- a/dlls/msvcrt/file.c    2005-12-08 06:00:17.000000000 -0800
+++ b/dlls/msvcrt/file.c    2006-01-17 15:20:30.000000000 -0800
@@ -1887,9 +1887,16 @@
 char *_tempnam(const char *dir, const char *prefix)
 {
   char tmpbuf[MAX_PATH];
+  char save_TMP[MAX_PATH];
+  const char *tmp_dir = dir;
+  
+  if (GetEnvironmentVariableA("TMP",save_TMP,sizeof(save_TMP)))
+  {
+    tmp_dir = save_TMP;
+  }
 
-  TRACE("dir (%s) prefix (%s)\n",dir,prefix);
-  if (GetTempFileNameA(dir,prefix,0,tmpbuf))
+  TRACE("dir (%s) prefix (%s)\n",tmp_dir,prefix);
+  if (GetTempFileNameA(tmp_dir,prefix,0,tmpbuf))
   {
     TRACE("got name (%s)\n",tmpbuf);
     DeleteFileA(tmpbuf);



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the wine-patches mailing list