mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-28 06:59:49 -05:00
connection: Handle fd passing in an CLOEXEC safe way
This commit is contained in:
parent
92d61f13b9
commit
8600408ced
1 changed files with 2 additions and 2 deletions
|
|
@ -300,7 +300,7 @@ wl_connection_data(struct wl_connection *connection, uint32_t mask)
|
|||
msg.msg_flags = 0;
|
||||
|
||||
do {
|
||||
len = recvmsg(connection->fd, &msg, 0);
|
||||
len = recvmsg(connection->fd, &msg, MSG_CMSG_CLOEXEC);
|
||||
} while (len < 0 && errno == EINTR);
|
||||
|
||||
if (len < 0) {
|
||||
|
|
@ -459,7 +459,7 @@ wl_connection_vmarshal(struct wl_connection *connection,
|
|||
extra += sizeof *fd_ptr;
|
||||
|
||||
fd = va_arg(ap, int);
|
||||
dup_fd = dup(fd);
|
||||
dup_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
||||
if (dup_fd < 0) {
|
||||
fprintf(stderr, "dup failed: %m");
|
||||
abort();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue