summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-21 15:45:16 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-21 15:45:16 +0000
commit7c936bcbb7f39894c429a40f0ca2199b4b8ebbf0 (patch)
treec616905cc249d86a5335b93bf3698812fe51abfc /win32
parent8fc91349e91bdcf3484ebc617ee3179228663a85 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@17514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c18
1 files changed, 15 insertions, 3 deletions
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;
}