+2013-07-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ * callproc.c (child_setup, relocate_fd) [!DOS_NT]:
+ * process.c (create_process) [!DOS_NT]:
+ Remove now-unnecessary calls to emacs_close.
+
2013-07-13 Eli Zaretskii <eliz@gnu.org>
* w32term.c (x_draw_hollow_cursor): Delete the brush object when
}
#ifndef MSDOS
- emacs_close (0);
- emacs_close (1);
- emacs_close (2);
-
- /* Redirect file descriptors and clear FD_CLOEXEC on the redirected ones. */
+ /* Redirect file descriptors and clear the close-on-exec flag on the
+ redirected ones. IN, OUT, and ERR are close-on-exec so they
+ need not be closed explicitly. */
dup2 (in, 0);
dup2 (out, 1);
dup2 (err, 2);
- emacs_close (in);
- if (out != in)
- emacs_close (out);
- if (err != in && err != out)
- emacs_close (err);
-
setpgid (0, 0);
tcsetpgrp (0, pid);
#ifndef WINDOWSNT
/* Move the file descriptor FD so that its number is not less than MINFD.
- If the file descriptor is moved at all, the original is freed. */
+ If the file descriptor is moved at all, the original is closed on MSDOS,
+ but not elsewhere as the caller will close it anyway. */
static int
relocate_fd (int fd, int minfd)
{
emacs_perror ("while setting up child");
_exit (EXIT_CANCELED);
}
+#ifdef MSDOS
emacs_close (fd);
+#endif
return new;
}
}
pid = child_setup (xforkin, xforkout, xforkout,
new_argv, 1, encoded_current_dir);
#else /* not WINDOWSNT */
- emacs_close (wait_child_setup[0]);
child_setup (xforkin, xforkout, xforkout,
new_argv, 1, encoded_current_dir);
#endif /* not WINDOWSNT */