[PATCH] linux: check the prefix 'wlan' for WiFi device as the last fallback
- From: "Shih-Yuan Lee (FourDollars)" <sylee canonical com>
- To: networkmanager-list gnome org
- Cc: "Shih-Yuan Lee (FourDollars)" <fourdollars gmail com>
- Subject: [PATCH] linux: check the prefix 'wlan' for WiFi device as the last fallback
- Date: Mon, 5 Dec 2016 15:37:53 +0800
https://bugzilla.gnome.org/show_bug.cgi?id=767317
Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee canonical com>
---
src/platform/wifi/wifi-utils.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/platform/wifi/wifi-utils.c b/src/platform/wifi/wifi-utils.c
index de858e4..95aae81 100644
--- a/src/platform/wifi/wifi-utils.c
+++ b/src/platform/wifi/wifi-utils.c
@@ -200,6 +200,15 @@ wifi_utils_is_wifi (const char *iface)
return TRUE;
#endif
+ /* The sysfs path may not exist due to race conditions while accessing sysfs.
+ * It's better to check the prefix 'wlan' as the last fallback method.
+ *
+ * For example, 'wlan0' has been renamed to 'wlp1s0', but it's still checking
+ * 'wlan0' above so it will always fail.
+ */
+ if (g_str_has_prefix (iface, "wlan"))
+ return TRUE;
+
return FALSE;
}
--
2.7.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]