[libiwinfo] apply FD_CLOEXEC on internal ioctl and netlink sockets
[project/luci.git] / contrib / package / iwinfo / src / iwinfo_wext.c
index 8fe0305..7bd1574 100644 (file)
@@ -89,7 +89,10 @@ static int wext_ioctl(const char *ifname, int cmd, struct iwreq *wrq)
 {
        /* prepare socket */
        if( ioctl_socket == -1 )
+       {
                ioctl_socket = socket(AF_INET, SOCK_DGRAM, 0);
+               fcntl(ioctl_socket, F_SETFD, fcntl(ioctl_socket, F_GETFD) | FD_CLOEXEC);
+       }
 
        if( !strncmp(ifname, "mon.", 4) )
                strncpy(wrq->ifr_name, &ifname[4], IFNAMSIZ);