Skip to content

Commit

Permalink
Windows SDL 1.x: Remove stdout/stderr redirection from SDL 1.x main c…
Browse files Browse the repository at this point in the history
…ode. It's not needed, and it causes problems and invalid state when you run DOSBox-X from an administrator-owned folder like Program Files.
  • Loading branch information
joncampbell123 committed Dec 26, 2017
1 parent bcf039a commit 21c98db
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions vs2015/sdl/src/main/win32/SDL_win32_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) );
Expand All @@ -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;
Expand Down

0 comments on commit 21c98db

Please sign in to comment.