projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix missing SOCK_CLOEXEC in various functions that use sockets internally
[musl]
/
src
/
network
/
if_nametoindex.c
diff --git
a/src/network/if_nametoindex.c
b/src/network/if_nametoindex.c
index
419931f
..
fb4a147
100644
(file)
--- 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;
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);
strncpy(ifr.ifr_name, name, sizeof ifr.ifr_name);
r = ioctl(fd, SIOCGIFINDEX, &ifr);
__syscall(SYS_close, fd);