X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fcallproc.c;h=8272ca99517fe73c5acacf113416331347afc9f3;hb=3f46c5336cd2a7c388b4ebba6b3e575e2b71cc86;hp=04f31cbc75352e88a02c1afbacb55baef9dafdf2;hpb=0298dde5c47a900f2542bc7ec6c9dafc92ce3015;p=chise%2Fxemacs-chise.git.1 diff --git a/src/callproc.c b/src/callproc.c index 04f31cb..8272ca9 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -47,6 +47,7 @@ Boston, MA 02111-1307, USA. */ #include "systime.h" #include "sysproc.h" +#include "sysdir.h" #include "sysfile.h" /* Always include after sysproc.h */ #include "sysdir.h" #include "syssignal.h" /* Always include before systty.h */ @@ -398,9 +399,6 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you } #endif } - /* Close STDERR into the parent process. We no longer need it. */ - if (fd_error >= 0) - close (fd_error); #else /* not WIN32_NATIVE */ pid = fork (); @@ -419,17 +417,18 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you child_setup (filefd, fd1, fd_error, new_argv, (char *) XSTRING_DATA (current_dir)); } - if (fd_error >= 0) - close (fd_error); - #endif /* not WIN32_NATIVE */ environ = save_environ; + /* Close STDERR into the parent process. We no longer need it. */ + if (fd_error >= 0) + close (fd_error); + /* Close most of our fd's, but not fd[0] since we will use that to read input from. */ close (filefd); - if (fd1 >= 0) + if ((fd1 >= 0) && (fd1 != fd_error)) close (fd1); }