static int nl80211_init(void)
{
- int err;
+ int err, fd;
if( !nls )
{
goto err;
}
+ fd = nl_socket_get_fd(nls->nl_sock);
+ if( fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC) < 0 )
+ {
+ err = -EINVAL;
+ goto err;
+ }
+
if( genl_ctrl_alloc_cache(nls->nl_sock, &nls->nl_cache)) {
err = -ENOMEM;
goto err;
remote_length = sizeof(remote.sun_family) + sprintf(remote.sun_path,
"/var/run/wpa_supplicant-%s/%s", ifname, ifname);
+ if( fcntl(sock, F_SETFD, fcntl(sock, F_GETFD) | FD_CLOEXEC) < 0 )
+ goto out;
+
if( connect(sock, (struct sockaddr *) &remote, remote_length) )
goto out;