emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100780: * callproc.c (relocate_fd):


From: Andreas Schwab
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100780: * callproc.c (relocate_fd): Use F_DUPFD if defined.
Date: Sun, 11 Jul 2010 11:49:44 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100780
committer: Andreas Schwab <address@hidden>
branch nick: emacs
timestamp: Sun 2010-07-11 11:49:44 +0200
message:
  * callproc.c (relocate_fd): Use F_DUPFD if defined.
modified:
  src/ChangeLog
  src/callproc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-07-11 09:27:13 +0000
+++ b/src/ChangeLog     2010-07-11 09:49:44 +0000
@@ -1,5 +1,7 @@
 2010-07-11  Andreas Schwab  <address@hidden>
 
+       * callproc.c (relocate_fd): Use F_DUPFD if defined.
+
        * alloc.c (pending_malloc_warning, malloc_warning): Add const.
        * callproc.c (relocate_fd, getenv_internal_1, getenv_internal)
        (egetenv): Likewise.

=== modified file 'src/callproc.c'
--- a/src/callproc.c    2010-07-11 09:27:13 +0000
+++ b/src/callproc.c    2010-07-11 09:49:44 +0000
@@ -1288,7 +1288,16 @@
     return fd;
   else
     {
-      int new = dup (fd);
+      int new;
+#ifdef F_DUPFD
+      new = fcntl (fd, F_DUPFD, minfd);
+#else
+      new = dup (fd);
+      if (new != -1)
+       /* Note that we hold the original FD open while we recurse,
+          to guarantee we'll get a new FD if we need it.  */
+       new = relocate_fd (new, minfd);
+#endif
       if (new == -1)
        {
          const char *message1 = "Error while setting up child: ";
@@ -1299,9 +1308,6 @@
          emacs_write (2, message2, strlen (message2));
          _exit (1);
        }
-      /* Note that we hold the original FD open while we recurse,
-        to guarantee we'll get a new FD if we need it.  */
-      new = relocate_fd (new, minfd);
       emacs_close (fd);
       return new;
     }


reply via email to

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