From: Bruno Haible Date: Sat, 10 Sep 2022 00:26:18 +0000 (+0200) Subject: posix_spawn-internal: Don't lose flags while duplicating an fd. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=40f62251c76684496cf05cf88452afce845352bb;p=gnulib.git posix_spawn-internal: Don't lose flags while duplicating an fd. * lib/spawni.c (do_dup2): Fix the flags of the new fd. --- diff --git a/ChangeLog b/ChangeLog index 7c237a1e66..564facbe53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2022-09-09 Bruno Haible + + posix_spawn-internal: Don't lose flags while duplicating an fd. + * lib/spawni.c (do_dup2): Fix the flags of the new fd. + 2022-09-09 Bruno Haible spawn-pipe: Fix pipe-filter-* test hangs (regression 2020-12-24). diff --git a/lib/spawni.c b/lib/spawni.c index 8125ce19ee..b9b0589460 100644 --- a/lib/spawni.c +++ b/lib/spawni.c @@ -471,7 +471,8 @@ do_dup2 (struct inheritable_handles *inh_handles, int oldfd, int newfd, errno = EBADF; /* arbitrary */ return -1; } - inh_handles->flags[newfd] = KEEP_OPEN_IN_CHILD; + inh_handles->flags[newfd] = + (unsigned char) inh_handles->flags[oldfd] | KEEP_OPEN_IN_CHILD; } return 0; }