]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport a patch from Mark Hammond.
authorThomas Heller <theller@ctypes.org>
Wed, 22 Dec 2004 15:35:20 +0000 (15:35 +0000)
committerThomas Heller <theller@ctypes.org>
Wed, 22 Dec 2004 15:35:20 +0000 (15:35 +0000)
Partial fix for [1067732] - "wininst --install-script leaves residual
files on C:\"

'tempnam()' is used rather than 'tmpnam()' - 'tmpnam' creates a temp
file on the root of the current drive, and if this is readonly
explains the 'freopen' errors occasionally reported. 'tempnam' creates
the temp file in the %TEMP% directory.

PC/bdist_wininst/install.c

index 8a92364f3f8214828d4ec0210e92198f797c831c..b6066e1bad10008589f1e80b0f3c516b3964aba0 100644 (file)
@@ -1708,7 +1708,7 @@ FinishedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                        if (logfile)
                                fprintf(logfile, "300 Run Script: [%s]%s\n", pythondll, fname);
 
-                       tempname = tmpnam(NULL);
+                       tempname = tempnam(NULL, NULL);
 
                        if (!freopen(tempname, "a", stderr))
                                MessageBox(GetFocus(), "freopen stderr", NULL, MB_OK);
@@ -2067,7 +2067,7 @@ BOOL Run_RemoveScript(char *line)
 
                argv[0] = scriptname;
 
-               tempname = tmpnam(NULL);
+               tempname = tempnam(NULL, NULL);
 
                if (!freopen(tempname, "a", stderr))
                        MessageBox(GetFocus(), "freopen stderr", NULL, MB_OK);