diff --git a/monitor/btsnoop.c b/monitor/btsnoop.c
index 0b3e412..147e9ee 100644
--- a/monitor/btsnoop.c
+++ b/monitor/btsnoop.c
if (btsnoop_fd >= 0)
return;
- btsnoop_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC,
+ btsnoop_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (btsnoop_fd < 0)
return;
return -1;
}
- btsnoop_fd = open(path, O_RDONLY);
+ btsnoop_fd = open(path, O_RDONLY | O_CLOEXEC);
if (btsnoop_fd < 0) {
perror("Failed to open file");
return -1;
diff --git a/monitor/control.c b/monitor/control.c
index 93189fd..49df440 100644
--- a/monitor/control.c
+++ b/monitor/control.c
struct sockaddr_hci addr;
int fd, opt = 1;
- fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ fd = socket(AF_BLUETOOTH, SOCK_RAW | SOCK_CLOEXEC, BTPROTO_HCI);
if (fd < 0) {
perror("Failed to open channel");
return -1;
unlink(path);
- fd = socket(PF_UNIX, SOCK_STREAM, 0);
+ fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (fd < 0) {
perror("Failed to open server socket");
return;
diff --git a/monitor/hcidump.c b/monitor/hcidump.c
index 373d2f5..4eb0a49 100644
--- a/monitor/hcidump.c
+++ b/monitor/hcidump.c
struct hci_filter flt;
int fd, opt = 1;
- fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ fd = socket(AF_BLUETOOTH, SOCK_RAW | SOCK_CLOEXEC, BTPROTO_HCI);
if (fd < 0) {
perror("Failed to open channel");
return -1;
struct hci_filter flt;
int fd, opt = 1;
- fd = socket(AF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
+ fd = socket(AF_BLUETOOTH, SOCK_RAW | SOCK_CLOEXEC, BTPROTO_HCI);
if (fd < 0) {
perror("Failed to open channel");
return -1;