diff src/callproc.c @ 109087:a089fae47976

Avoid erroneous syscalls * process.c (create_process): Avoid using invalid file descriptors. * callproc.c (child_setup): Avoid closing a file descriptor twice.
author Andreas Schwab <schwab@linux-m68k.org>
date Thu, 01 Jul 2010 01:07:11 +0200
parents 734073f5d073
children aec1143e8d85
line wrap: on
line diff
--- a/src/callproc.c	Thu Jul 01 01:07:00 2010 +0200
+++ b/src/callproc.c	Thu Jul 01 01:07:11 2010 +0200
@@ -1244,8 +1244,10 @@
   dup2 (out, 1);
   dup2 (err, 2);
   emacs_close (in);
-  emacs_close (out);
-  emacs_close (err);
+  if (out != in)
+    emacs_close (out);
+  if (err != in && err != out)
+    emacs_close (err);
 #endif /* not MSDOS */
 #endif /* not WINDOWSNT */