From 56feff58d4fab92701ae77a1004af820b85e7f6c Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 24 Mar 2015 11:23:35 +0100 Subject: Use assert to print diagnosicts before calling abort. * src/posix-lock.c: Add assert calls. Signed-off-by: Werner Koch --- src/posix-lock.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') 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 #include #include +#include #if USE_POSIX_THREADS # include @@ -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. */ -- cgit v1.2.3