public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd
@ 2023-04-29 14:57 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2023-04-29 14:57 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=89f1e04174a6b6548d19f7f301ddcc8ab91d91df

commit 89f1e04174a6b6548d19f7f301ddcc8ab91d91df
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Sat Apr 29 16:13:53 2023 +0300

    hurd: Respect existing FD_CLOEXEC in S_msg_set_fd
    
    If the process has set the close-on-exec flag for the file descriptor,
    it expects the file descriptor to get closed on exec, even if we replace
    what the file descriptor refers to.
    
    Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
    Message-Id: <20230429131354.2507443-6-bugaevc@gmail.com>

Diff:
---
 hurd/hurdmsg.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hurd/hurdmsg.c b/hurd/hurdmsg.c
index 896fb87cfa..8fde1f535d 100644
--- a/hurd/hurdmsg.c
+++ b/hurd/hurdmsg.c
@@ -323,7 +323,13 @@ _S_msg_set_fd (mach_port_t msgport, mach_port_t auth,
   AUTHCHECK;
 
   /* We consume the reference if successful.  */
-  err = HURD_FD_USE (which, (_hurd_port2fd (descriptor, port, 0), 0));
+  err = HURD_FD_USE (which,
+		     ({
+		       int flags = (descriptor->flags & FD_CLOEXEC)
+				   ? O_CLOEXEC : 0;
+		       _hurd_port2fd (descriptor, port, flags);
+		       0;
+		     }));
   if (err)
     return err;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-29 14:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29 14:57 [glibc] hurd: Respect existing FD_CLOEXEC in S_msg_set_fd Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).