From: Niraj Kumar Goit Date: Mon, 19 Nov 2018 07:13:20 +0000 (+0530) Subject: Fix svace issue [WGID: 378746]. X-Git-Tag: accepted/tizen/unified/20181122.160707^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F12%2F193312%2F2;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Fix svace issue [WGID: 378746]. Use strerror_r function instead of strerror for thread safety. Change-Id: Ib75cded4baaab3ae1862e594f409df9ec6511e71 Signed-off-by: Niraj Kumar Goit --- diff --git a/src/wifi-power.c b/src/wifi-power.c index c900012..c1e4aaf 100755 --- a/src/wifi-power.c +++ b/src/wifi-power.c @@ -517,6 +517,7 @@ void wifi_set_early_suspend(gboolean value) int ioctl_sock = 0; int pm_state = 0; wifi_service_state_e wifi_state; + char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, }; if (old_state == value) { DBG("Old and new states are same"); @@ -552,15 +553,17 @@ void wifi_set_early_suspend(gboolean value) ioctl_sock = socket(PF_INET, SOCK_DGRAM, 0); if (ioctl_sock < 0) { - DBG("socket(PF_INET,SOCK_DGRAM) failed"); + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); + DBG("socket(PF_INET,SOCK_DGRAM) failed: %s", error_buf); return; } ret = ioctl(ioctl_sock, WLAN_IOCTL_SUSPEND, &ifr); - if (ret < 0) - ERR("Fail to issue private commands: %d. %s", ret, strerror(errno)); - else { + if (ret < 0) { + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER); + ERR("Fail to issue private commands: %d. %s", ret, error_buf); + } else { old_state = value; }