diff options
Diffstat (limited to 'contrib/package/iwinfo/src/iwinfo_nl80211.c')
-rw-r--r-- | contrib/package/iwinfo/src/iwinfo_nl80211.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/package/iwinfo/src/iwinfo_nl80211.c b/contrib/package/iwinfo/src/iwinfo_nl80211.c index a643efbdc2..49ddf13fb8 100644 --- a/contrib/package/iwinfo/src/iwinfo_nl80211.c +++ b/contrib/package/iwinfo/src/iwinfo_nl80211.c @@ -32,7 +32,7 @@ static struct nl80211_state *nls = NULL; static int nl80211_init(void) { - int err; + int err, fd; if( !nls ) { @@ -53,6 +53,13 @@ static int nl80211_init(void) 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; @@ -332,6 +339,9 @@ static char * nl80211_wpasupp_info(const char *ifname, const char *cmd) 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; |