{
// 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, 1);
+ fcntl(server_sock, F_SETFD, O_CLOEXEC);
}
AcceptorProto Acceptor::serialize() const
{
// 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);
+ fcntl(sock, F_SETFD, O_CLOEXEC);
if (stream != nullptr) {
if (setsockopt(sock, SOL_SOCKET, SO_MAX_PACING_RATE, &stream->pacing_rate, sizeof(stream->pacing_rate)) == -1) {
{
// 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);
+ fcntl(sock, F_SETFD, O_CLOEXEC);
pending_data.resize(serialized.pending_data().size());
memcpy(&pending_data[0], serialized.pending_data().data(), serialized.pending_data().size());
#include <assert.h>
+#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <assert.h>
#include <errno.h>
+#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <math.h>
exit(1);
}
+ // Set the close-on-exec parameter back on the backlog fd.
+ fcntl(data_fd, F_SETFD, O_CLOEXEC);
+
for (ssize_t point : serialized.suitable_starting_point()) {
if (point == -1) {
// Can happen when upgrading from before 1.1.3,
serialized.set_first_fragment_index(first_fragment_index);
serialized.set_discontinuity_counter(discontinuity_counter);
+ // Unset the close-on-exec flag for the backlog fd.
+ // (This can't leak into a child, since there's only one thread left.)
+ fcntl(data_fd, F_SETFD, 0);
+
serialized.set_url(url);
data_fd = -1;
return 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, 1);
+ fcntl(sock, F_SETFD, O_CLOEXEC);
// Should be verified by the caller.
string protocol;