X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fnetwork%2Fif_nametoindex.c;h=fb4a14747edeb4836f59a290391128a504c4019f;hp=419931f9f35311ab3da34c5633c47e58b82d133e;hb=0716b10ac8dc167f96969c964974d4094035fed0;hpb=ca9aff6a1646c7fc106bfbb9399b3a1bcb14f18b 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);