From: Thomas Heller Date: Wed, 22 Dec 2004 15:35:20 +0000 (+0000) Subject: Backport a patch from Mark Hammond. X-Git-Tag: v2.3.5c1~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8f67c3e045f85782016e30b5950b271b27058ae4;p=thirdparty%2FPython%2Fcpython.git Backport a patch from Mark Hammond. 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. --- diff --git a/PC/bdist_wininst/install.c b/PC/bdist_wininst/install.c index 8a92364f3f82..b6066e1bad10 100644 --- a/PC/bdist_wininst/install.c +++ b/PC/bdist_wininst/install.c @@ -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);