}
if_freenameindex(ii);
- int sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
+ int sock = socket(PF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP);
if(sock == -1) goto err2;
struct ifreq reqs[32]; /* arbitrary chosen boundary */
struct ifconf conf = {.ifc_len = sizeof reqs, .ifc_req = reqs};
struct ifreq ifr;
int fd, r;
- if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) return 0;
+ if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) return 0;
ifr.ifr_ifindex = index;
r = ioctl(fd, SIOCGIFNAME, &ifr);
__syscall(SYS_close, fd);
{
size_t n;
void *p = 0;
- int s = socket(AF_UNIX, SOCK_DGRAM, 0);
+ int s = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0);
if (s>=0) {
for (n=0; (p=do_nameindex(s, n)) == (void *)-1; n++);
__syscall(SYS_close, s);
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);