diff options
author | Andreas Schwab <schwab@suse.de> | 2022-10-01 12:47:42 -0400 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-10-02 08:46:00 -0400 |
commit | c801a7fb6703e9aeeed2605eaa0c715cadecbfb3 (patch) | |
tree | 5bfd5edcf6c3a862f32c9919a5d82eaa2a773a88 /src/posixos.c | |
parent | c2eddf9be2cc5cd0c91bd5781e44cd5bcc251be4 (diff) | |
download | make-git-c801a7fb6703e9aeeed2605eaa0c715cadecbfb3.tar.gz |
[SV 63111] Ensure output-sync is cleaned on re-exec and recursion
Now that output-sync is using a separate file as a mutex rather than
stdout, ensure the new file descriptor is closed before re-exec and
not inherited by children.
* src/main.c (main): Call osync_clear() before re-exec.
* src/posixos.c (osync_setup): Reset output-sync handle inheritance.
(osync_parse_mutex): Ditto.
Copyright-paperwork-exempt: yes
Diffstat (limited to 'src/posixos.c')
-rw-r--r-- | src/posixos.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/posixos.c b/src/posixos.c index d587f9c8..c6500efa 100644 --- a/src/posixos.c +++ b/src/posixos.c @@ -462,7 +462,7 @@ jobserver_acquire (int timeout) case EBADF: /* Someone closed the jobs pipe. That shouldn't happen but if it does we're done. */ - O (fatal, NILF, _("job server shut down")); + O (fatal, NILF, _("job server shut down")); default: pfatal_with_name (_("pselect jobs pipe")); @@ -628,7 +628,10 @@ osync_setup () { osync_handle = get_tmpfd (&osync_tmpfile); if (osync_handle >= 0) - sync_parent = 1; + { + fd_noinherit (osync_handle); + sync_parent = 1; + } } char * @@ -662,6 +665,8 @@ osync_parse_mutex (const char *mutex) OSS (fatal, NILF, _("cannot open output sync mutex %s: %s"), osync_tmpfile, strerror (errno)); + fd_noinherit (osync_handle); + return 1; } |