summaryrefslogtreecommitdiff
path: root/src/log.cpp
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-01-15 16:40:41 +0000
committerChristian Pointner <equinox@anytun.org>2009-01-15 16:40:41 +0000
commit95a317d43f0d101013593fd2c1af00e7865f98cd (patch)
tree0d478683f1359051f219f1283979557dc1d71877 /src/log.cpp
parentlog class can now easily use errno and gpg_err (diff)
added a workaround for strerror_r problem
moved initLibGcrypt to right position (needs to be called before any other libgcrypt call)
Diffstat (limited to 'src/log.cpp')
-rw-r--r--src/log.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/log.cpp b/src/log.cpp
index 3fb569c..2fa603e 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -57,9 +57,16 @@ std::ostream& operator<<(std::ostream& stream, LogErrno const& value)
{
char buf[STERROR_TEXT_MAX];
buf[0] = 0;
-// TODO: fix to use XSI Compliant strerror_r
- char* tmp = strerror_r(value.err_, buf, STERROR_TEXT_MAX);
- return stream << tmp;
+ char* errStr;
+// this really sucks, g++ seems to unconditionally define _GNU_SOURCE
+// and undefining it breaks the build...
+#ifdef _GNU_SOURCE
+ errStr = strerror_r(value.err_, buf, STERROR_TEXT_MAX);
+#else
+ strerror_r(value.err_, buf, STERROR_TEXT_MAX);
+ errStr = buf;
+#endif
+ return stream << errStr;
}
LogStringBuilder::LogStringBuilder(LogStringBuilder const& src) : log(src.log), prio(src.prio)