From: Nishant Chaprana Date: Mon, 20 Sep 2021 09:08:56 +0000 (+0530) Subject: Use strerror_r() instead of strerror() X-Git-Tag: accepted/tizen/unified/20210924.055921~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F264457%2F1;p=platform%2Fcore%2Fconnectivity%2Fnet-config.git Use strerror_r() instead of strerror() Change-Id: I8360ca2084a8a08ec4f8f219384c6c7516870035 Signed-off-by: Nishant Chaprana --- diff --git a/plugin/online-monitor/online-monitor.c b/plugin/online-monitor/online-monitor.c index b2bde47..3c61e10 100755 --- a/plugin/online-monitor/online-monitor.c +++ b/plugin/online-monitor/online-monitor.c @@ -64,6 +64,7 @@ static int open_raw_socket(const char *ifname) { struct sockaddr_ll sock_ll; int sock; + char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, }; sock = socket(PF_PACKET, SOCK_RAW | SOCK_NONBLOCK | SOCK_CLOEXEC, htons(ETH_P_ALL)); if (sock < 0) { @@ -77,7 +78,8 @@ static int open_raw_socket(const char *ifname) sock_ll.sll_protocol = htons(ETH_P_ALL); if (bind(sock, (struct sockaddr *)&sock_ll, sizeof(sock_ll)) < 0) { - ERR("bind failed, ifname %s error %s\n", ifname, strerror(errno)); + ERR("bind failed, ifname %s error %s\n", ifname, + strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER)); close(sock); return -1; }