You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2018/06/01 15:00:17 UTC

[07/11] qpid-dispatch git commit: DISPATCH-965: Let's fix the Ubuntu build! :)

DISPATCH-965: Let's fix the Ubuntu build! :)


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/9d3cecf9
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/9d3cecf9
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/9d3cecf9

Branch: refs/heads/master
Commit: 9d3cecf993daf7a0a59ee9afb00bac7d9fb26ee4
Parents: a5c40da
Author: Kenneth Giusti <kg...@apache.org>
Authored: Wed May 16 17:04:56 2018 -0400
Committer: Kenneth Giusti <kg...@apache.org>
Committed: Wed May 16 17:04:56 2018 -0400

----------------------------------------------------------------------
 src/error.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/9d3cecf9/src/error.c
----------------------------------------------------------------------
diff --git a/src/error.c b/src/error.c
index b62ae1d..4a7c815 100644
--- a/src/error.c
+++ b/src/error.c
@@ -23,13 +23,20 @@
 #include <qpid/dispatch/enum.h>
 #include <qpid/dispatch/log.h>
 #include <stdarg.h>
-#include <stdio.h>
 #include <errno.h>
 #include <string.h>
 #include "log_private.h"
 #include "aprintf.h"
 #include "python_private.h"
 
+// force the use of the non-gnu version of strerror_r
+#undef _POSIX_C_SOURCE
+#undef _GNU_SOURCE
+#define _POSIX_C_SOURCE 200112L
+#define _GNU_SOURCE 0
+#include <stdio.h>
+
+
 static const char *qd_error_names[] = {
  "No Error",
  "Not found",
@@ -198,8 +205,11 @@ qd_error_t qd_error_errno_impl(int errnum, const char *file, int line, const cha
         vaprintf(&begin, end, fmt, arglist);
         va_end(arglist);
         aprintf(&begin, end, ": ", errnum);
-        (void)strerror_r(errnum, begin, end - begin);
-        qd_log_impl(log_source, QD_LOG_ERROR, file, line, "%s", ts.error_message);
+        char *em = ts.error_message;
+        if(strerror_r(errnum, begin, end - begin) != 0) {
+            snprintf(begin, end - begin, "Unknown error %d", errnum);
+        }
+        qd_log_impl(log_source, QD_LOG_ERROR, file, line, "%s", em);
         return qd_error_code();
     }
     else


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org