diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Src/exec.c | 2 | ||||
-rw-r--r-- | Src/parse.c | 7 |
3 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog index 387d3f230..37436aae4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-07-20 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 31545: Src/exec.c, Src/parse.c: if FD_CLOEXEC is available, + so mark dump file file descriptors, avoiding possible + multiple use of file descriptors. + 2013-07-19 Peter Stephenson <p.w.stephenson@ntlworld.com> * c.f. 31531: Completion/Unix/Command/_imagemagick, diff --git a/Src/exec.c b/Src/exec.c index d462d97c6..f9efb3a19 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -448,7 +448,9 @@ zexecve(char *pth, char **argv, char **newenvp) else sprintf(buf + 2, "%s/%s", pwd, pth); zputenv(buf); +#ifndef FD_CLOEXEC closedumps(); +#endif if (newenvp == NULL) newenvp = environ; diff --git a/Src/parse.c b/Src/parse.c index 753080d70..b670925de 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -3171,6 +3171,9 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len) d->dev = sbuf->st_dev; d->ino = sbuf->st_ino; d->fd = fd; +#ifdef FD_CLOEXEC + fcntl(fd, F_SETFD, FD_CLOEXEC); +#endif d->map = addr + (other ? (len - off) / sizeof(wordcode) : 0); d->addr = addr; d->len = len; @@ -3439,6 +3442,7 @@ decrdumpcount(FuncDump f) } } +#ifndef FD_CLOEXEC /**/ mod_export void closedumps(void) @@ -3448,6 +3452,7 @@ closedumps(void) for (p = dumps; p; p = p->next) zclose(p->fd); } +#endif #else @@ -3461,11 +3466,13 @@ decrdumpcount(FuncDump f) { } +#ifndef FD_CLOEXEC /**/ mod_export void closedumps(void) { } +#endif #endif |