qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r681193 - /incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/StrError.cpp
Date Wed, 30 Jul 2008 20:21:23 GMT
Author: astitcher
Date: Wed Jul 30 13:21:23 2008
New Revision: 681193

URL: http://svn.apache.org/viewvc?rev=681193&view=rev
Log:
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

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/StrError.cpp

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/StrError.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/StrError.cpp?rev=681193&r1=681192&r2=681193&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/StrError.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/sys/posix/StrError.cpp Wed Jul 30 13:21:23 2008
@@ -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
 }
 
 }}



Mime
View raw message