ruby-changes:21734
From: usa <ko1@a...>
Date: Fri, 18 Nov 2011 13:06:13 +0900 (JST)
Subject: [ruby-changes:21734] usa:r33783 (trunk): * io.c (rb_cloexec_open): set O_NOINHERIT instead of O_CLOEXEC if it is
usa 2011-11-18 13:06:01 +0900 (Fri, 18 Nov 2011) New Revision: 33783 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33783 Log: * io.c (rb_cloexec_open): set O_NOINHERIT instead of O_CLOEXEC if it is available (for Windows). * win32/win32.c (fcntl): on F_DUPFD, determine the inheritance of the new handle by O_NOINHERIT flag of original fd. Modified files: trunk/ChangeLog trunk/io.c trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33782) +++ ChangeLog (revision 33783) @@ -1,3 +1,11 @@ +Fri Nov 18 13:03:38 2011 NAKAMURA Usaku <usa@r...> + + * io.c (rb_cloexec_open): set O_NOINHERIT instead of O_CLOEXEC if it is + available (for Windows). + + * win32/win32.c (fcntl): on F_DUPFD, determine the inheritance of the + new handle by O_NOINHERIT flag of original fd. + Fri Nov 18 08:00:41 2011 Ryan Davis <ryan@l...> * lib/minitest/*: Imported minitest 2.8.1 (r6750) Index: io.c =================================================================== --- io.c (revision 33782) +++ io.c (revision 33783) @@ -195,6 +195,8 @@ #ifdef O_CLOEXEC /* O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ flags |= O_CLOEXEC; +#elif defined O_NOINHERIT + flags |= O_NOINHERIT; #endif ret = open(pathname, flags, mode); if (ret == -1) return -1; Index: win32/win32.c =================================================================== --- win32/win32.c (revision 33782) +++ win32/win32.c (revision 33783) @@ -3849,7 +3849,8 @@ int ret; HANDLE hDup; if (!(DuplicateHandle(GetCurrentProcess(), (HANDLE)_get_osfhandle(fd), - GetCurrentProcess(), &hDup, 0L, TRUE, + GetCurrentProcess(), &hDup, 0L, + !(_osfile(fd) & FNOINHERIT), DUPLICATE_SAME_ACCESS))) { errno = map_errno(GetLastError()); return -1; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/