Compare commits

..

No commits in common. "burble.dn42" and "master" have entirely different histories.

2 changed files with 9 additions and 21 deletions

View File

@ -80,26 +80,17 @@ std::string logger::format(const std::string& fmt, ...)
return buf;
}
// alpine has a broken definition for strerr_r
// see https://stackoverflow.com/questions/41953104/strerror-r-is-incorrectly-declared-on-alpine-linux
std::string logger::err_str(int result, char *buff, int err)
{
if (result)
sprintf(buff, "unknown error: %d", err);
return buff;
}
std::string logger::err_str(char *result, char *buff, int err)
{
return result;
}
std::string logger::err()
{
char buf[2048];
return logger::err_str(strerror_r(errno, buf, sizeof(buf)), buf, errno);
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
if (strerror_r(errno, buf, sizeof(buf))
return "Unknown error";
return buf;
#else
return strerror_r(errno, buf, sizeof(buf));
#endif
}
logger logger::error()

View File

@ -74,7 +74,6 @@ public:
static std::string err();
private:
int _pri;
std::stringstream _ss;
@ -92,9 +91,7 @@ private:
static int _max_pri;
// fixes for strerr_r on alpine
static std::string err_str(int result, char *buff, int err);
static std::string err_str(char *result, char *buff, int err);
};
NDPPD_NS_END