summaryrefslogtreecommitdiff
path: root/trans/streamio.c
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 /trans/streamio.c
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 'trans/streamio.c')
-rw-r--r--trans/streamio.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/trans/streamio.c b/trans/streamio.c
index 5539c8ea..f276ad6b 100644
--- a/trans/streamio.c
+++ b/trans/streamio.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <string.h>
-#include <assert.h>
+#include <assert-backtrace.h>
#include <stdio.h>
#include <fcntl.h>
#include <argp.h>
@@ -74,11 +74,11 @@ static inline struct buffer *
create_buffer (size_t size)
{
struct buffer *new = malloc (sizeof (struct buffer) + size);
- assert (new);
+ assert_backtrace (new);
new->head = new->tail = new->buf;
new->size = size;
new->wait = malloc (sizeof (pthread_cond_t));
- assert (new->wait);
+ assert_backtrace (new->wait);
pthread_cond_init (new->wait, NULL);
return new;
}
@@ -862,12 +862,12 @@ device_open_reply (mach_port_t reply, int returncode, mach_port_t device)
}
else if (err == 0)
{
- assert (sizes_len == DEV_GET_SIZE_COUNT);
+ assert_backtrace (sizes_len == DEV_GET_SIZE_COUNT);
dev_blksize = sizes[DEV_GET_SIZE_RECORD_SIZE];
dev_size = sizes[DEV_GET_SIZE_DEVICE_SIZE];
- assert (dev_blksize && dev_blksize <= IO_INBAND_MAX);
+ assert_backtrace (dev_blksize && dev_blksize <= IO_INBAND_MAX);
}
else
{
@@ -990,7 +990,7 @@ dev_read (size_t amount, void **buf, size_t *len, int nowait)
vm_allocate (mach_task_self (), (vm_address_t *)buf, max, 1);
*len = buffer_read (input_buffer, *buf, max);
- assert (*len == max);
+ assert_backtrace (*len == max);
err = start_input (nowait);
return err;
@@ -1057,7 +1057,7 @@ start_output (int nowait)
{
int size;
- assert (output_buffer);
+ assert_backtrace (output_buffer);
size = buffer_size (output_buffer);