#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, FD_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;