aboutsummaryrefslogtreecommitdiffstats
path: root/src/posix-lock.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-03-24 10:23:35 +0000
committerWerner Koch <[email protected]>2015-03-24 10:23:35 +0000
commit56feff58d4fab92701ae77a1004af820b85e7f6c (patch)
treea4571086d5291de1200d258a37c8331ea5759feb /src/posix-lock.c
parentpo: Update Czech translation (diff)
downloadlibgpg-error-56feff58d4fab92701ae77a1004af820b85e7f6c.tar.gz
libgpg-error-56feff58d4fab92701ae77a1004af820b85e7f6c.zip
Use assert to print diagnosicts before calling abort.
* src/posix-lock.c: Add assert calls. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/posix-lock.c')
-rw-r--r--src/posix-lock.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/posix-lock.c b/src/posix-lock.c
index 7f20347..89be944 100644
--- a/src/posix-lock.c
+++ b/src/posix-lock.c
@@ -33,6 +33,7 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <assert.h>
#if USE_POSIX_THREADS
# include <pthread.h>
@@ -88,7 +89,10 @@ use_pthread_p (void)
/* Thread creation works. */
void *retval;
if (pthread_join (thread, &retval) != 0)
- abort ();
+ {
+ assert (!"pthread_join");
+ abort ();
+ }
result = 1;
}
tested = 1;
@@ -106,9 +110,15 @@ get_lock_object (gpgrt_lock_t *lockhd)
_gpgrt_lock_t *lock = (_gpgrt_lock_t*)lockhd;
if (lock->vers != LOCK_ABI_VERSION)
- abort ();
+ {
+ assert (!"lock ABI version");
+ abort ();
+ }
if (sizeof (gpgrt_lock_t) < sizeof (_gpgrt_lock_t))
- abort ();
+ {
+ assert (!"sizeof lock obj");
+ abort ();
+ }
return lock;
}
@@ -126,7 +136,10 @@ _gpgrt_lock_init (gpgrt_lock_t *lockhd)
if (!lock->vers)
{
if (sizeof (gpgrt_lock_t) < sizeof (_gpgrt_lock_t))
- abort ();
+ {
+ assert (!"sizeof lock obj");
+ abort ();
+ }
lock->vers = LOCK_ABI_VERSION;
}
else /* Run the usual check. */