From 21c98db3e696517eb0611ade585cad5f720c8962 Mon Sep 17 00:00:00 2001 From: Jonathan Campbell Date: Mon, 25 Dec 2017 21:55:00 -0800 Subject: [PATCH] Windows SDL 1.x: Remove stdout/stderr redirection from SDL 1.x main code. It's not needed, and it causes problems and invalid state when you run DOSBox-X from an administrator-owned folder like Program Files. --- vs2015/sdl/src/main/win32/SDL_win32_main.c | 30 ---------------------- 1 file changed, 30 deletions(-) diff --git a/vs2015/sdl/src/main/win32/SDL_win32_main.c b/vs2015/sdl/src/main/win32/SDL_win32_main.c index 672b48c12e8..e3eef5ab5ef 100644 --- a/vs2015/sdl/src/main/win32/SDL_win32_main.c +++ b/vs2015/sdl/src/main/win32/SDL_win32_main.c @@ -219,22 +219,6 @@ static void redirect_output(void) SDL_strlcpy( stdoutPath, path, SDL_arraysize(stdoutPath) ); SDL_strlcat( stdoutPath, DIR_SEPERATOR STDOUT_FILE, SDL_arraysize(stdoutPath) ); #endif - - /* Redirect standard input and standard output */ - newfp = freopen(stdoutPath, TEXT("w"), stdout); - -#ifndef _WIN32_WCE - if ( newfp == NULL ) { /* This happens on NT */ -#if !defined(stdout) - stdout = fopen(stdoutPath, TEXT("w")); -#else - newfp = fopen(stdoutPath, TEXT("w")); - if ( newfp ) { - *stdout = *newfp; - } -#endif - } -#endif /* _WIN32_WCE */ #ifdef _WIN32_WCE wcsncpy( stderrPath, path, SDL_arraysize(stdoutPath) ); @@ -244,20 +228,6 @@ static void redirect_output(void) SDL_strlcat( stderrPath, DIR_SEPERATOR STDERR_FILE, SDL_arraysize(stderrPath) ); #endif - newfp = freopen(stderrPath, TEXT("w"), stderr); -#ifndef _WIN32_WCE - if ( newfp == NULL ) { /* This happens on NT */ -#if !defined(stderr) - stderr = fopen(stderrPath, TEXT("w")); -#else - newfp = fopen(stderrPath, TEXT("w")); - if ( newfp ) { - *stderr = *newfp; - } -#endif - } -#endif /* _WIN32_WCE */ - setvbuf(stdout, NULL, _IOLBF, BUFSIZ); /* Line buffered */ setbuf(stderr, NULL); /* No buffering */ stdioRedirectEnabled = 1;