#include <assert.h>
#include <errno.h>
+#include <fcntl.h>
#include <poll.h>
#include <stddef.h>
#include <stdlib.h>
: 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, FD_CLOEXEC);
+
// Should be verified by the caller.
string protocol;
bool ok = parse_url(url, &protocol, &user, &host, &port, &path);
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);