emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113418: * callproc.c (child_setup, relocate_fd) [!D


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113418: * callproc.c (child_setup, relocate_fd) [!DOS_NT]:
Date: Sun, 14 Jul 2013 00:30:49 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113418
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2013-07-13 17:30:45 -0700
message:
  * callproc.c (child_setup, relocate_fd) [!DOS_NT]:
  
  * process.c (create_process) [!DOS_NT]:
  Remove now-unnecessary calls to emacs_close.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/callproc.c                 callproc.c-20091113204419-o5vbwnq5f7feedwu-248
  src/process.c                  process.c-20091113204419-o5vbwnq5f7feedwu-462
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-07-13 14:21:01 +0000
+++ b/src/ChangeLog     2013-07-14 00:30:45 +0000
@@ -1,3 +1,9 @@
+2013-07-14  Paul Eggert  <address@hidden>
+
+       * 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  <address@hidden>
 
        * w32term.c (x_draw_hollow_cursor): Delete the brush object when

=== modified file 'src/callproc.c'
--- a/src/callproc.c    2013-07-12 17:30:48 +0000
+++ b/src/callproc.c    2013-07-14 00:30:45 +0000
@@ -1346,21 +1346,13 @@
   }
 
 #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);
 
@@ -1386,7 +1378,8 @@
 
 #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)
 {
@@ -1400,7 +1393,9 @@
          emacs_perror ("while setting up child");
          _exit (EXIT_CANCELED);
        }
+#ifdef MSDOS
       emacs_close (fd);
+#endif
       return new;
     }
 }

=== modified file 'src/process.c'
--- a/src/process.c     2013-07-12 17:30:48 +0000
+++ b/src/process.c     2013-07-14 00:30:45 +0000
@@ -1831,7 +1831,6 @@
       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 */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]