diff options
author | Martin Hurton <hurtonm@gmail.com> | 2009-08-31 11:31:32 +0200 |
---|---|---|
committer | Martin Hurton <hurtonm@gmail.com> | 2009-08-31 13:31:01 +0200 |
commit | 0aacee389fdb553ef9925d0135eefcb501a67726 (patch) | |
tree | 33e5bd2a58eabe4f5a8a2cdbe1f11b5147ef7490 /src/err.hpp | |
parent | 72fdf47d16c8d3ecd9da657b4649978e414d775c (diff) |
POSIX threads don't use errno to report errors
Fix simple_semaphore to follow POSIX threads convention for reporting
errors.
Diffstat (limited to 'src/err.hpp')
-rw-r--r-- | src/err.hpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/err.hpp b/src/err.hpp index 3854d8a..c1b2916 100644 --- a/src/err.hpp +++ b/src/err.hpp @@ -22,6 +22,7 @@ #include <assert.h> #include <errno.h> +#include <string.h> #include <stdlib.h> #include <stdio.h> @@ -81,10 +82,10 @@ namespace zmq }} while (false) // Provides convenient way to check for POSIX errors. -#define posix_assert(x) do {\ -fprintf (stderr, "%s (%s:%d)\n", strerror (x), __FILE__, __LINE__);\ -abort ();\ -} while (false) +#define posix_assert(x) do { if ((x)) {\ + fprintf (stderr, "%s (%s:%d)\n", strerror (x), __FILE__, __LINE__);\ + abort ();\ +}} while (false) // Provides convenient way to check for errors from getaddrinfo. #define gai_assert(x) do { if (x) {\ |