OSDN Git Service

2009-05-29 Kai Tietz <kai.tietz@onevision.com>
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 May 2009 20:20:40 +0000 (20:20 +0000)
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 29 May 2009 20:20:40 +0000 (20:20 +0000)
        * pex-win32.c (pex_win32_fdopenr): Set INHERIT to false.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147984 138bc75d-0d04-0410-961f-82ee72b054a4

libiberty/ChangeLog
libiberty/pex-win32.c

index 837dbda..5d93cf1 100644 (file)
@@ -1,3 +1,7 @@
+2009-05-29  Kai Tietz  <kai.tietz@onevision.com>
+
+        * pex-win32.c (pex_win32_fdopenr): Set INHERIT to false.
+
 2009-05-29  Michael Matz  <matz@suse.de>
 
        * fibheap.c (fibheap_replace_key_data): Make sure we don't early
index 91e0bc8..4427406 100644 (file)
@@ -915,6 +915,11 @@ static FILE *
 pex_win32_fdopenr (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd,
                   int binary)
 {
+  HANDLE h = (HANDLE) _get_osfhandle (fd);
+  if (h == INVALID_HANDLE_VALUE)
+    return NULL;
+  if (! SetHandleInformation (h, HANDLE_FLAG_INHERIT, 0))
+    return NULL;
   return fdopen (fd, binary ? "rb" : "r");
 }