diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-21 15:45:16 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-06-21 15:45:16 +0000 |
commit | 5adfbaee49bfb6a692f01352eb67c3d04f66bc35 (patch) | |
tree | c616905cc249d86a5335b93bf3698812fe51abfc /win32 | |
parent | 53f4527d5a90cc38c2a322926ba271c749c14be3 (diff) | |
download | ruby-5adfbaee49bfb6a692f01352eb67c3d04f66bc35.tar.gz ruby-5adfbaee49bfb6a692f01352eb67c3d04f66bc35.tar.xz ruby-5adfbaee49bfb6a692f01352eb67c3d04f66bc35.zip |
* win32/win32.c (rb_w32_osid, rb_w32_osver, CreateChild): XP is
is different from Vista about pipe handle inheritance.
fixed [ruby-core:17367]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@17514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 897321309..e79bbf2ba 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; } |