From 8652af728dadc4fbed94f58c4d50518704f554fb Mon Sep 17 00:00:00 2001 From: root Date: Thu, 12 Nov 2015 10:33:03 +0100 Subject: [PATCH] FIX: building without gnu's strerror_r --- src/Utils.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index f259547..637f542 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -418,10 +418,16 @@ string Utils::errnotostrerror(int errnum) { char buf[2048]=""; char *strerr; -// if(strerror_r(errnum,strerr,1024)!=-1) #ifndef WIN32 + #ifdef __GLIBC__ strerr=strerror_r(errnum,buf,2048); #else + int retval = strerror_r(errnum, buf, sizeof buf); + strerr = buf; + if(retval != 0) + strcpy(buf, "error fetching error description"); + #endif + #else strerr="Error "; #endif //WIN32 return string(strerr)+" ("+inttostr(errnum)+")";