summaryrefslogtreecommitdiff
path: root/libfshelp
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-06-19 21:20:57 +0200
committerJustus Winter <justus@gnupg.org>2017-08-05 18:42:22 +0200
commit835b293d35a209d38047126443d41fa7090daa4c (patch)
tree5bf956895e6030f91cd618fb191b2151f6d25423 /libfshelp
parentdc0b5a43224999223a246870912b0f292b1980e9 (diff)
Use our own variant of 'assert' and 'assert_perror'.
Our variants print stack traces on failures. This will make locating errors much easier.
Diffstat (limited to 'libfshelp')
-rw-r--r--libfshelp/fetch-control.c4
-rw-r--r--libfshelp/fetch-root.c4
-rw-r--r--libfshelp/get-identity.c4
-rw-r--r--libfshelp/lock-acquire.c12
-rw-r--r--libfshelp/start-translator-long.c4
5 files changed, 14 insertions, 14 deletions
diff --git a/libfshelp/fetch-control.c b/libfshelp/fetch-control.c
index 91c65bb0..0a11197a 100644
--- a/libfshelp/fetch-control.c
+++ b/libfshelp/fetch-control.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "fshelp.h"
-#include <assert.h>
+#include <assert-backtrace.h>
error_t
fshelp_fetch_control (struct transbox *box,
@@ -34,7 +34,7 @@ fshelp_fetch_control (struct transbox *box,
if (err == KERN_INVALID_RIGHT)
{
err = mach_port_deallocate (mach_task_self (), *control);
- assert_perror (err);
+ assert_perror_backtrace (err);
*control = box->active = MACH_PORT_NULL;
}
diff --git a/libfshelp/fetch-root.c b/libfshelp/fetch-root.c
index 75aa2d37..0248f11d 100644
--- a/libfshelp/fetch-root.c
+++ b/libfshelp/fetch-root.c
@@ -18,7 +18,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <hurd/fsys.h>
#include <hurd/paths.h>
#include <hurd/ports.h>
@@ -47,7 +47,7 @@ fshelp_fetch_root (struct transbox *box, void *cookie,
start_over:
if (box->active != MACH_PORT_NULL)
- assert ((box->flags & TRANSBOX_STARTING) == 0);
+ assert_backtrace ((box->flags & TRANSBOX_STARTING) == 0);
else
{
uid_t uid, gid;
diff --git a/libfshelp/get-identity.c b/libfshelp/get-identity.c
index 2dbd254c..17244dee 100644
--- a/libfshelp/get-identity.c
+++ b/libfshelp/get-identity.c
@@ -23,7 +23,7 @@
#include <hurd/ports.h>
#include <hurd/ihash.h>
#include <stddef.h>
-#include <assert.h>
+#include <assert-backtrace.h>
static struct port_class *idclass = 0;
static pthread_mutex_t idlock = PTHREAD_MUTEX_INITIALIZER;
@@ -49,7 +49,7 @@ id_clean (void *cookie)
static void
id_initialize ()
{
- assert (!idclass);
+ assert_backtrace (!idclass);
idclass = ports_create_class (id_clean, NULL);
}
diff --git a/libfshelp/lock-acquire.c b/libfshelp/lock-acquire.c
index 07df4283..47a63dab 100644
--- a/libfshelp/lock-acquire.c
+++ b/libfshelp/lock-acquire.c
@@ -19,7 +19,7 @@
/* Written by Michael I. Bushnell. */
-#include <assert.h>
+#include <assert-backtrace.h>
#include <sys/file.h>
#include "fshelp.h"
@@ -60,9 +60,9 @@ fshelp_acquire_lock (struct lock_box *box, int *user, pthread_mutex_t *mut,
if (*user & LOCK_UN)
return 0;
- assert (*user == box->type ||
+ assert_backtrace (*user == box->type ||
(*user == LOCK_SH && box->type == (LOCK_SH | LOCK_EX)));
- assert (*user == LOCK_SH || *user == LOCK_EX ||
+ assert_backtrace (*user == LOCK_SH || *user == LOCK_EX ||
*user == (LOCK_SH | LOCK_EX));
if (*user == LOCK_SH)
@@ -153,10 +153,10 @@ fshelp_acquire_lock (struct lock_box *box, int *user, pthread_mutex_t *mut,
return EINTR;
}
- assert ((flags & LOCK_SH) || (flags & LOCK_EX));
+ assert_backtrace ((flags & LOCK_SH) || (flags & LOCK_EX));
if (flags & LOCK_SH)
{
- assert (!(box->type & LOCK_EX));
+ assert_backtrace (!(box->type & LOCK_EX));
*user = LOCK_SH;
box->type = LOCK_SH;
box->shcount++;
@@ -182,7 +182,7 @@ fshelp_acquire_lock (struct lock_box *box, int *user, pthread_mutex_t *mut,
}
if (*user == LOCK_SH)
{
- assert (box->shcount == 1);
+ assert_backtrace (box->shcount == 1);
box->shcount = 0;
}
box->type = LOCK_EX;
diff --git a/libfshelp/start-translator-long.c b/libfshelp/start-translator-long.c
index da6f52e3..e1aea3c4 100644
--- a/libfshelp/start-translator-long.c
+++ b/libfshelp/start-translator-long.c
@@ -26,7 +26,7 @@
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include "fshelp.h"
@@ -247,7 +247,7 @@ fshelp_start_translator_long (fshelp_open_fn_t underlying_open_fn,
if (err)
goto lose_task;
- assert (ports_len > INIT_PORT_BOOTSTRAP);
+ assert_backtrace (ports_len > INIT_PORT_BOOTSTRAP);
switch (ports_type)
{
case MACH_MSG_TYPE_MAKE_SEND: