From 2fb61f25833fc8db40ee3ffe1b589b6476499adc Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 24 Oct 2018 17:10:21 +0200 Subject: [PATCH] logsyserr(): no strerror_r on Windows --- src/utils/log.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utils/log.h b/src/utils/log.h index 1c3549f8..bbef77b8 100644 --- a/src/utils/log.h +++ b/src/utils/log.h @@ -193,6 +193,12 @@ private: #endif #define LOGFATAL LOGFAT +#if defined(sun) || defined(_WIN32) +#define LOGSYSERR(who, what, arg) { \ + LOGERR(who << ": " << what << "(" << arg << "): errno " << errno << \ + ": " << strerror(errno) << std::endl); \ + } +#else // !WINDOWS-> #if (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE #define LOGSYSERR(who, what, arg) { \ char buf[200]; buf[0] = 0; strerror_r(errno, buf, 200); \ @@ -206,4 +212,6 @@ private: ": " << strerror_r(errno, buf, 200) << std::endl); \ } #endif +#endif // not windows + #endif /* _LOG_H_X_INCLUDED_ */