Compare commits
No commits in common. "burble.dn42" and "master" have entirely different histories.
burble.dn4
...
master
@ -80,26 +80,17 @@ std::string logger::format(const std::string& fmt, ...)
|
|||||||
return buf;
|
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()
|
std::string logger::err()
|
||||||
{
|
{
|
||||||
char buf[2048];
|
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()
|
logger logger::error()
|
||||||
|
@ -74,7 +74,6 @@ public:
|
|||||||
static std::string err();
|
static std::string err();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int _pri;
|
int _pri;
|
||||||
|
|
||||||
std::stringstream _ss;
|
std::stringstream _ss;
|
||||||
@ -92,9 +91,7 @@ private:
|
|||||||
|
|
||||||
static int _max_pri;
|
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
|
NDPPD_NS_END
|
||||||
|
Loading…
x
Reference in New Issue
Block a user