aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorPaul Eggert2013-07-13 17:30:45 -0700
committerPaul Eggert2013-07-13 17:30:45 -0700
commit4700b5a52dd4dcb27c4beee2c3fda4bfd0ac0e74 (patch)
tree03ba0299d44124ec139fce871a3b2d11590d8823 /src/callproc.c
parent2ce3c56586f4061727ace4daed4582d2aa6f8e98 (diff)
downloademacs-4700b5a52dd4dcb27c4beee2c3fda4bfd0ac0e74.tar.gz
emacs-4700b5a52dd4dcb27c4beee2c3fda4bfd0ac0e74.zip
* callproc.c (child_setup, relocate_fd) [!DOS_NT]:
* process.c (create_process) [!DOS_NT]: Remove now-unnecessary calls to emacs_close.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 30f9dc58d46..cdf92422b4d 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1346,21 +1346,13 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1346 } 1346 }
1347 1347
1348#ifndef MSDOS 1348#ifndef MSDOS
1349 emacs_close (0); 1349 /* Redirect file descriptors and clear the close-on-exec flag on the
1350 emacs_close (1); 1350 redirected ones. IN, OUT, and ERR are close-on-exec so they
1351 emacs_close (2); 1351 need not be closed explicitly. */
1352
1353 /* Redirect file descriptors and clear FD_CLOEXEC on the redirected ones. */
1354 dup2 (in, 0); 1352 dup2 (in, 0);
1355 dup2 (out, 1); 1353 dup2 (out, 1);
1356 dup2 (err, 2); 1354 dup2 (err, 2);
1357 1355
1358 emacs_close (in);
1359 if (out != in)
1360 emacs_close (out);
1361 if (err != in && err != out)
1362 emacs_close (err);
1363
1364 setpgid (0, 0); 1356 setpgid (0, 0);
1365 tcsetpgrp (0, pid); 1357 tcsetpgrp (0, pid);
1366 1358
@@ -1386,7 +1378,8 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1386 1378
1387#ifndef WINDOWSNT 1379#ifndef WINDOWSNT
1388/* Move the file descriptor FD so that its number is not less than MINFD. 1380/* Move the file descriptor FD so that its number is not less than MINFD.
1389 If the file descriptor is moved at all, the original is freed. */ 1381 If the file descriptor is moved at all, the original is closed on MSDOS,
1382 but not elsewhere as the caller will close it anyway. */
1390static int 1383static int
1391relocate_fd (int fd, int minfd) 1384relocate_fd (int fd, int minfd)
1392{ 1385{
@@ -1400,7 +1393,9 @@ relocate_fd (int fd, int minfd)
1400 emacs_perror ("while setting up child"); 1393 emacs_perror ("while setting up child");
1401 _exit (EXIT_CANCELED); 1394 _exit (EXIT_CANCELED);
1402 } 1395 }
1396#ifdef MSDOS
1403 emacs_close (fd); 1397 emacs_close (fd);
1398#endif
1404 return new; 1399 return new;
1405 } 1400 }
1406} 1401}