diff options
| author | Andrew Stitcher <astitcher@apache.org> | 2008-07-30 20:21:23 +0000 |
|---|---|---|
| committer | Andrew Stitcher <astitcher@apache.org> | 2008-07-30 20:21:23 +0000 |
| commit | 853c549269efe73d1f4931d305dd37985f0bc1bc (patch) | |
| tree | fbfa68747c654832196de567c5c7047a3e2590cc /cpp/src | |
| parent | 85926059396c2ae3eb501f40c39b8fd71977e7b0 (diff) | |
| download | qpid-python-853c549269efe73d1f4931d305dd37985f0bc1bc.tar.gz | |
The previous attempt to only get an xpg strerror_r with the GNU failed
instead use the definition of _GNU_SOURCE as a proxy for the gnu version
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@681193 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
| -rw-r--r-- | cpp/src/qpid/sys/posix/StrError.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/cpp/src/qpid/sys/posix/StrError.cpp b/cpp/src/qpid/sys/posix/StrError.cpp index deb2fca7eb..633e20213c 100644 --- a/cpp/src/qpid/sys/posix/StrError.cpp +++ b/cpp/src/qpid/sys/posix/StrError.cpp @@ -21,24 +21,21 @@ #include "qpid/sys/StrError.h" -// Ensure we get the POSIX verion of strerror_r -#ifndef _XOPEN_SOURCE -#define _XOPEN_SOURCE 600 #include <string.h> -#undef _XOPEN_SOURCE -#else -#include <string.h> -#endif - namespace qpid { namespace sys { std::string strError(int err) { - char buf[512]; - //POSIX strerror_r doesn't return the buffer + char buf[512] = "Unknown error"; +#ifdef _GNU_SOURCE + // GNU strerror_r returns the message + return ::strerror_r(err, buf, sizeof(buf)); +#else + // POSIX strerror_r doesn't return the buffer ::strerror_r(err, buf, sizeof(buf)); return std::string(buf); +#endif } }} |
