X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=udpinput.cpp;h=ecd099a529913250b99531f4427fa6c56ec6d91f;hp=4b421a3e4fe90c91732a7a24c53adc476175fd7d;hb=6d34c5b6d8e5bec5d1421eadc103f38d206f34f1;hpb=d34b94a858c08d64eddfb9c115719fd9129be933 diff --git a/udpinput.cpp b/udpinput.cpp index 4b421a3..ecd099a 100644 --- a/udpinput.cpp +++ b/udpinput.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -120,6 +121,10 @@ UDPInput::UDPInput(const InputProto &serialized) : url(serialized.url()), sock(serialized.sock()) { + // 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, 1); + // Should be verified by the caller. string protocol; bool ok = parse_url(url, &protocol, &user, &host, &port, &path); @@ -139,6 +144,10 @@ UDPInput::UDPInput(const InputProto &serialized) InputProto UDPInput::serialize() const { + // Unset the close-on-exec flag for the socket. + // (This can't leak into a child, since there's only one thread left.) + fcntl(sock, F_SETFD, 0); + InputProto serialized; serialized.set_url(url); serialized.set_sock(sock);