diff options
Diffstat (limited to 'src/platform/wifi/wifi-utils.c')
| -rw-r--r-- | src/platform/wifi/wifi-utils.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/platform/wifi/wifi-utils.c b/src/platform/wifi/wifi-utils.c index 2ce6eb77..b8da02c1 100644 --- a/src/platform/wifi/wifi-utils.c +++ b/src/platform/wifi/wifi-utils.c @@ -56,7 +56,7 @@ wifi_data_free (WifiData *data) g_free (data); } -/***************************************************************/ +/*****************************************************************************/ WifiData * wifi_utils_init (const char *iface, int ifindex, gboolean check_scan) @@ -183,39 +183,19 @@ wifi_utils_deinit (WifiData *data) } gboolean -wifi_utils_is_wifi (int ifindex, const char *ifname) +wifi_utils_is_wifi (int dirfd, const char *ifname) { - int fd_sysnet; - int fd_phy80211; - char ifname_verified[IFNAMSIZ]; + g_return_val_if_fail (dirfd >= 0, FALSE); - g_return_val_if_fail (ifindex > 0, FALSE); - - fd_sysnet = nmp_utils_sysctl_open_netdir (ifindex, ifname, ifname_verified); - if (fd_sysnet < 0) - return FALSE; - - /* there might have been a race and ifname might be wrong. Below for checking - * wext, use the possibly improved name that we just verified. */ - ifname = ifname_verified; - - fd_phy80211 = openat (fd_sysnet, "phy80211", O_CLOEXEC); - close (fd_sysnet); - - if (fd_phy80211 >= 0) { - close (fd_phy80211); + if (faccessat (dirfd, "phy80211", F_OK, 0) == 0) return TRUE; - } - #if HAVE_WEXT if (wifi_wext_is_wifi (ifname)) return TRUE; #endif - return FALSE; } - /* OLPC Mesh-only functions */ guint32 |