1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00

* callproc.c (relocate_fd): Use F_DUPFD if defined.

This commit is contained in:
Andreas Schwab 2010-07-11 11:49:44 +02:00
parent a8fe7202b4
commit cf237e277f
2 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,7 @@
2010-07-11 Andreas Schwab <schwab@linux-m68k.org>
* 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.

View File

@ -1288,7 +1288,16 @@ relocate_fd (int fd, int minfd)
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 @@ relocate_fd (int fd, int minfd)
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;
}