http://bugs.winehq.org/show_bug.cgi?id=26876
Summary: special file CON not handled correctly Product: Wine Version: 1.3.15 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: shell32 AssignedTo: wine-bugs@winehq.org ReportedBy: stefankriwanek@gmx.net
Created an attachment (id=34269) --> (http://bugs.winehq.org/attachment.cgi?id=34269) test binary
In some applications, it is desirable to temporarily redirect stdout/stderr to a file, and then switch back to the console output. This can be accomplished using the special file "CON", as stated at http://support.microsoft.com/kb/58667/en-us Wine seems not to handle this as windows does:
To reproduce, please compile the following C source or run the attached binary: #include <stdio.h> #include <errno.h> int main() { errno=0; fopen("CON", "w" ); printf("errno: %u\n", errno); errno=0;
freopen("CON", "w", stdout ); printf("errno: %u\n", errno); errno=0;
freopen("CON", "w", stderr ); printf("errno: %u\n", errno); }
On native Windows, this outputs 'errno: 0' into the terminal three times.
On wine, it outputs 'errno: 13' (=EACCESS, permission denied) after the first fopen. The further two output lines get lost. They're not written to named file "CON" either.
I set the severity to normal, since I don't know another way of accessing the console attached to the program, if stdout/stderr were redirected. Also this might affect any SDL program, as re-redirection to the console is recommended there (http://sdl.beuc.net/sdl.wiki/FAQ_Console). (Running SDL apps through wine is convenient during development)
Note: For SDL programs, however, the redirection of stdout and stderr to files can be disabled in the first place by setting the environment variable 'SDL_STDIO_REDIRECT' to '0'.