diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win32/win32.c | 18 |
2 files changed, 21 insertions, 3 deletions
@@ -1,3 +1,9 @@ +Sun Jun 22 00:42:02 2008 NAKAMURA Usaku <usa@ruby-lang.org> + + * win32/win32.c (rb_w32_osid, rb_w32_osver, CreateChild): XP is + is different from Vista about pipe handle inheritance. + fixed [ruby-core:17367] + Sun Jun 22 00:38:45 2008 NAKAMURA Usaku <usa@ruby-lang.org> * README.EXT.ja: add note about mark and free. diff --git a/win32/win32.c b/win32/win32.c index 8973213097..e79bbf2bad 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -200,14 +200,13 @@ rb_w32_map_errno(DWORD winerr) static const char *NTLoginName; +static OSVERSIONINFO osver; #ifdef WIN95 static DWORD Win32System = (DWORD)-1; DWORD rb_w32_osid(void) { - static OSVERSIONINFO osver; - if (osver.dwPlatformId != Win32System) { memset(&osver, 0, sizeof(OSVERSIONINFO)); osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); @@ -217,6 +216,19 @@ rb_w32_osid(void) return (Win32System); } #endif +static DWORD Win32Version = (DWORD)-1; + +static DWORD +rb_w32_osver(void) +{ + if (osver.dwMajorVersion != Win32Version) { + memset(&osver, 0, sizeof(OSVERSIONINFO)); + osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osver); + Win32Version = osver.dwMajorVersion; + } + return (Win32Version); +} #define IsWinNT() rb_w32_iswinnt() #define IsWin95() rb_w32_iswin95() @@ -882,7 +894,7 @@ CreateChild(const char *cmd, const char *prog, SECURITY_ATTRIBUTES *psa, if (!psa) { sa.nLength = sizeof (SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = FALSE; + sa.bInheritHandle = IsWinNT() && rb_w32_osver() > 5 ? FALSE : TRUE; psa = &sa; } |