modules: add SOCK_CLOEXEC to all socket() calls

This commit is contained in:
Daniel Eklöf 2022-03-29 18:21:13 +02:00
parent 3ff1c95208
commit 4bb81e8940
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 5 additions and 5 deletions

View file

@ -167,7 +167,7 @@ nl_pid_value(void)
static int
netlink_connect_rt(void)
{
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
int sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_ROUTE);
if (sock == -1) {
LOG_ERRNO("failed to create netlink socket");
return -1;
@ -191,7 +191,7 @@ netlink_connect_rt(void)
static int
netlink_connect_genl(void)
{
int sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
int sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, NETLINK_GENERIC);
if (sock == -1) {
LOG_ERRNO("failed to create netlink socket");
return -1;