about summary refs log tree commit diff
path: root/src/network/if_nametoindex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/if_nametoindex.c')
-rw-r--r--src/network/if_nametoindex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/if_nametoindex.c b/src/network/if_nametoindex.c
index 419931f9..fb4a1474 100644
--- a/src/network/if_nametoindex.c
+++ b/src/network/if_nametoindex.c
@@ -10,7 +10,7 @@ unsigned if_nametoindex(const char *name)
 	struct ifreq ifr;
 	int fd, r;
 
-	if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) return -1;
+	if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return -1;
 	strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
 	r = ioctl(fd, SIOCGIFINDEX, &ifr);
 	__syscall(SYS_close, fd);