This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Rev 146953 seems not to work proper for mingw targets


On Thu, 14 May 2009 20:08:50 -0400
DJ Delorie <dj@redhat.com> wrote:

> 
> > > Yes, it works again.
> > 
> > Cool. In that case, OK to apply (to gcc/sourceware)?
> 
> If Kai approves it, it's OK with me.  Please post a patch against svn
> trunk, though, for the record.

I've applied this version now.

Cheers,

Julian

ChangeLog

    libiberty/
    * pex-win32.c (pex_win32_exec_child): Fix logic to avoid closing
    standard handles (stdin, stdout, stderr) in parent.
Index: pex-win32.c
===================================================================
--- pex-win32.c	(revision 147626)
+++ pex-win32.c	(working copy)
@@ -753,17 +753,20 @@ pex_win32_exec_child (struct pex_obj *ob
      original descriptors.  */
   orig_in = in;
   in = _dup (orig_in);
-  _close (orig_in);
+  if (orig_in != STDIN_FILENO)
+    _close (orig_in);
   
   orig_out = out;
   out = _dup (orig_out);
-  _close (orig_out);
+  if (orig_out != STDOUT_FILENO)
+    _close (orig_out);
   
   if (separate_stderr)
     {
       orig_err = errdes;
       errdes = _dup (orig_err);
-      _close (orig_err);
+      if (orig_err != STDERR_FILENO)
+	_close (orig_err);
     }
 
   stdin_handle = INVALID_HANDLE_VALUE;
@@ -844,11 +847,9 @@ pex_win32_exec_child (struct pex_obj *ob
   /* Close the standard input, standard output and standard error handles
      in the parent.  */ 
 
-  if (in != STDIN_FILENO)
-    _close (in);
-  if (out != STDOUT_FILENO)
-    _close (out);
-  if (errdes != STDERR_FILENO)
+  _close (in);
+  _close (out);
+  if (separate_stderr)
     _close (errdes);
 
   return pid;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]