Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f25b72

Browse files
author
Thomas Heller
committed
Close stdout and stderr, which are redirected into a temp file, before
trying to remove this file - the file was never removed before. Fixes [ 1067732 ] wininst --install-script leaves residual files Already backported.
1 parent b300ae3 commit 0f25b72

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

PC/bdist_wininst/install.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,8 +611,8 @@ PyMethodDef meth[] = {
611611
static HINSTANCE LoadPythonDll(char *fname)
612612
{
613613
char fullpath[_MAX_PATH];
614-
char subkey_name[80];
615614
LONG size = sizeof(fullpath);
615+
char subkey_name[80];
616616
HINSTANCE h = LoadLibrary(fname);
617617
if (h)
618618
return h;
@@ -760,7 +760,9 @@ static int run_simple_script(char *script)
760760
rc = do_run_simple_script(hPython, script);
761761
FreeLibrary(hPython);
762762
fflush(stderr);
763+
fclose(stderr);
763764
fflush(stdout);
765+
fclose(stdout);
764766
/* We only care about the output when we fail. If the script works
765767
OK, then we discard it
766768
*/
@@ -1951,7 +1953,9 @@ FinishedDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
19511953
fprintf(stderr, "*** Could not load Python ***");
19521954
}
19531955
fflush(stderr);
1956+
fclose(stderr);
19541957
fflush(stdout);
1958+
fclose(stdout);
19551959

19561960
fp = fopen(tempname, "rb");
19571961
n = fread(buffer, 1, sizeof(buffer), fp);
@@ -2299,7 +2303,9 @@ BOOL Run_RemoveScript(char *line)
22992303
}
23002304

23012305
fflush(stderr);
2306+
fclose(stderr);
23022307
fflush(stdout);
2308+
fclose(stdout);
23032309

23042310
fp = fopen(tempname, "rb");
23052311
n = fread(buffer, 1, sizeof(buffer), fp);

0 commit comments

Comments
 (0)