From 5fd548d5cfa9a96a247319398654c944eb52a671 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 17 May 2020 21:27:56 +1000 Subject: [PATCH] Fix use of unportable MSG_CMSG_CLOEXEC --- src/remote.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/remote.cc b/src/remote.cc index dea4d853..abb321e8 100644 --- a/src/remote.cc +++ b/src/remote.cc @@ -294,7 +294,7 @@ private: msg.msg_control = fdbuf; msg.msg_controllen = sizeof(fdbuf); - int res = recvmsg(sock, &msg, MSG_CMSG_CLOEXEC); + int res = recvmsg(sock, &msg, 0); if (res <= 0) throw disconnected{format("socket read failed: {}", strerror(errno))}; @@ -305,6 +305,7 @@ private: { m_ancillary_fd.map(close); memcpy(&m_ancillary_fd.emplace(), CMSG_DATA(cmsg), sizeof(int)); + fcntl(*m_ancillary_fd, F_SETFD, FD_CLOEXEC); } }