From ed8da2cd25b017df55c1de39bfa41158d2c3c6ec Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Mon, 20 Mar 2017 22:54:02 +0100 Subject: [PATCH] wifi-utils: fix use of errno It can be overwritten when other arguments are evaluated. --- src/platform/wifi/wifi-utils-wext.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platform/wifi/wifi-utils-wext.c b/src/platform/wifi/wifi-utils-wext.c index f99790e6fa..21a6dadb83 100644 --- a/src/platform/wifi/wifi-utils-wext.c +++ b/src/platform/wifi/wifi-utils-wext.c @@ -476,6 +476,7 @@ wifi_wext_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len) struct iwreq wrq; char buf[IW_ESSID_MAX_SIZE + 1]; char ifname[IFNAMSIZ]; + int errsv; if (!get_ifname (data->ifindex, ifname, "set-mesh-ssid")) return FALSE; @@ -492,11 +493,12 @@ wifi_wext_set_mesh_ssid (WifiData *data, const guint8 *ssid, gsize len) return TRUE; if (errno != ENODEV) { + errsv = errno; nm_log_err (LOGD_PLATFORM | LOGD_WIFI | LOGD_OLPC, "(%s): error setting SSID to '%s': %s", ifname, ssid ? nm_utils_escape_ssid (ssid, len) : "(null)", - strerror (errno)); + strerror (errsv)); } return FALSE;