diff options
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 14 |
1 files changed, 10 insertions, 4 deletions
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 | } |