From 757d3a3a170faf4c30115df1cea43a47a425add5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 2 Apr 2023 22:25:09 +0200 Subject: [PATCH] Fix yet more stupid close-on-exec bugs. --- acceptor.cpp | 2 +- client.cpp | 2 +- httpinput.cpp | 2 +- stream.cpp | 2 +- udpinput.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/acceptor.cpp b/acceptor.cpp index 31901dd..75dd70b 100644 --- a/acceptor.cpp +++ b/acceptor.cpp @@ -104,7 +104,7 @@ Acceptor::Acceptor(const AcceptorProto &serialized) { // Set back the close-on-exec flag for the socket. // (This can't leak into a child, since we haven't been started yet.) - fcntl(server_sock, F_SETFD, O_CLOEXEC); + fcntl(server_sock, F_SETFD, FD_CLOEXEC); } AcceptorProto Acceptor::serialize() const diff --git a/client.cpp b/client.cpp index 5d5c179..fb278e2 100644 --- a/client.cpp +++ b/client.cpp @@ -72,7 +72,7 @@ Client::Client(const ClientProto &serialized, const vectorpacing_rate, sizeof(stream->pacing_rate)) == -1) { diff --git a/httpinput.cpp b/httpinput.cpp index 75cf99b..b2b6207 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -81,7 +81,7 @@ HTTPInput::HTTPInput(const InputProto &serialized) // Set back the close-on-exec flag for the socket. // (This can't leak into a child, since we haven't been started yet.) if (sock != -1) { - fcntl(sock, F_SETFD, O_CLOEXEC); + fcntl(sock, F_SETFD, FD_CLOEXEC); } pending_data.resize(serialized.pending_data().size()); diff --git a/stream.cpp b/stream.cpp index 4e5ca24..c79391a 100644 --- a/stream.cpp +++ b/stream.cpp @@ -69,7 +69,7 @@ Stream::Stream(const StreamProto &serialized, int data_fd) } // Set the close-on-exec parameter back on the backlog fd. - fcntl(data_fd, F_SETFD, O_CLOEXEC); + fcntl(data_fd, F_SETFD, FD_CLOEXEC); for (ssize_t point : serialized.suitable_starting_point()) { if (point == -1) { diff --git a/udpinput.cpp b/udpinput.cpp index 873b0b9..824c3bc 100644 --- a/udpinput.cpp +++ b/udpinput.cpp @@ -123,7 +123,7 @@ UDPInput::UDPInput(const InputProto &serialized) { // Set back the close-on-exec flag for the socket. // (This can't leak into a child, since we haven't been started yet.) - fcntl(sock, F_SETFD, O_CLOEXEC); + fcntl(sock, F_SETFD, FD_CLOEXEC); // Should be verified by the caller. string protocol; -- 2.39.2