aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2010-07-11 11:49:44 +0200
committerAndreas Schwab2010-07-11 11:49:44 +0200
commitcf237e277f6b033fd8d47ecdc466722c73de5d96 (patch)
treeaa015ae22b6639c2a212936fcafdd108f4f66299 /src
parenta8fe7202b4d4b86cdc66997dc624a367631abd51 (diff)
downloademacs-cf237e277f6b033fd8d47ecdc466722c73de5d96.tar.gz
emacs-cf237e277f6b033fd8d47ecdc466722c73de5d96.zip
* callproc.c (relocate_fd): Use F_DUPFD if defined.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog2
-rw-r--r--src/callproc.c14
2 files changed, 12 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d6002ad2b20..6907c5add4c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,7 @@
12010-07-11 Andreas Schwab <schwab@linux-m68k.org> 12010-07-11 Andreas Schwab <schwab@linux-m68k.org>
2 2
3 * callproc.c (relocate_fd): Use F_DUPFD if defined.
4
3 * alloc.c (pending_malloc_warning, malloc_warning): Add const. 5 * alloc.c (pending_malloc_warning, malloc_warning): Add const.
4 * callproc.c (relocate_fd, getenv_internal_1, getenv_internal) 6 * callproc.c (relocate_fd, getenv_internal_1, getenv_internal)
5 (egetenv): Likewise. 7 (egetenv): Likewise.
diff --git a/src/callproc.c b/src/callproc.c
index e78d1a9aeaa..4ad6bcf41ea 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1288,7 +1288,16 @@ relocate_fd (int fd, int minfd)
1288 return fd; 1288 return fd;
1289 else 1289 else
1290 { 1290 {
1291 int new = dup (fd); 1291 int new;
1292#ifdef F_DUPFD
1293 new = fcntl (fd, F_DUPFD, minfd);
1294#else
1295 new = dup (fd);
1296 if (new != -1)
1297 /* Note that we hold the original FD open while we recurse,
1298 to guarantee we'll get a new FD if we need it. */
1299 new = relocate_fd (new, minfd);
1300#endif
1292 if (new == -1) 1301 if (new == -1)
1293 { 1302 {
1294 const char *message1 = "Error while setting up child: "; 1303 const char *message1 = "Error while setting up child: ";
@@ -1299,9 +1308,6 @@ relocate_fd (int fd, int minfd)
1299 emacs_write (2, message2, strlen (message2)); 1308 emacs_write (2, message2, strlen (message2));
1300 _exit (1); 1309 _exit (1);
1301 } 1310 }
1302 /* Note that we hold the original FD open while we recurse,
1303 to guarantee we'll get a new FD if we need it. */
1304 new = relocate_fd (new, minfd);
1305 emacs_close (fd); 1311 emacs_close (fd);
1306 return new; 1312 return new;
1307 } 1313 }