Blindly setting FD_CLOEXEC without a read-modify-write will
inadvertently clear any other intentionally-set bits, such as a
proposed new bit for designating a fd that must behave in 32-bit mode.
Use our wrapper function instead of an incorrect hand-rolled version.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <
20200420175309.75894-2-eblake@redhat.com>
Reviewed-by: Colin Xu <colin.xu@intel.com>
fprintf(stderr, "Failed to open the hax module\n");
}
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(fd);
return fd;
}
fd = open(vm_name, O_RDWR);
g_free(vm_name);
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(fd);
return fd;
}
if (fd < 0) {
fprintf(stderr, "Failed to open the vcpu devfs\n");
}
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(fd);
return fd;
}