ruby-changes:6005
From: usa <ko1@a...>
Date: Sun, 22 Jun 2008 00:45:53 +0900 (JST)
Subject: [ruby-changes:6005] Ruby:r17514 (trunk): * win32/win32.c (rb_w32_osid, rb_w32_osver, CreateChild): XP is
usa 2008-06-22 00:45:16 +0900 (Sun, 22 Jun 2008) New Revision: 17514 Modified files: trunk/ChangeLog trunk/win32/win32.c Log: * win32/win32.c (rb_w32_osid, rb_w32_osver, CreateChild): XP is is different from Vista about pipe handle inheritance. fixed [ruby-core:17367] http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/win32/win32.c?r1=17514&r2=17513&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17514&r2=17513&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 17513) +++ ChangeLog (revision 17514) @@ -1,3 +1,9 @@ +Sun Jun 22 00:42:02 2008 NAKAMURA Usaku <usa@r...> + + * 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@r...> * README.EXT.ja: add note about mark and free. Index: win32/win32.c =================================================================== --- win32/win32.c (revision 17513) +++ win32/win32.c (revision 17514) @@ -200,14 +200,13 @@ 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,7 +216,20 @@ 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 @@ if (!psa) { sa.nLength = sizeof (SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = FALSE; + sa.bInheritHandle = IsWinNT() && rb_w32_osver() > 5 ? FALSE : TRUE; psa = &sa; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/