diff options
Diffstat (limited to 'win32/win32.c')
-rw-r--r-- | win32/win32.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c index 9de71d7a25..92d00166bd 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -409,6 +409,8 @@ static void init_env(void) NTLoginName[len] = '\0'; } +static void init_stdhandle(); + // // Initialization stuff // @@ -431,6 +433,8 @@ NtInitialize(int *argc, char ***argv) init_env(); + init_stdhandle(); + // Initialize Winsock StartSockets(); } @@ -1647,11 +1651,29 @@ rb_w32_open_osfhandle(long osfhandle, int flags) } return fh; /* return handle */ } + +static void +init_stdhandle() +{ + if (fileno(stdin) < 0) { + stdin->_file = 0; + } + if (fileno(stdout) < 0) { + stdout->_file = 1; + } + if (fileno(stderr) < 0) { + stderr->_file = 2; + } +} #else #define _set_osfhnd(fh, osfh) (void)((fh), (osfh)) #define _set_osflags(fh, flags) (void)((fh), (flags)) +static void +init_stdhandle() +{ +} #endif #ifdef __BORLANDC__ |