9 #define CCAN_RFC822_DEBUG
11 #include <ccan/rfc822/rfc822.h>
13 #include <ccan/talloc/talloc.h>
15 static bool should_fail = false;
17 static void *mayfail_alloc(const void *ctx, size_t size)
21 return talloc_zero_size(ctx, size);
24 /* Override various tallocation functions. */
28 #define talloc(ctx, type) mayfail_alloc((ctx), sizeof(type))
29 #define talloc_zero(ctx, type) mayfail_alloc((ctx), sizeof(type))
30 #define talloc_array(ctx, type, num) mayfail_alloc((ctx), sizeof(type)*(num))
32 #include <ccan/rfc822/rfc822.c>
36 static void abort_handler(int signum)
42 int main(int argc, char *argv[])
46 struct rfc822_msg *msg;
47 struct sigaction sa = {
48 .sa_handler = abort_handler,
52 ret = sigaction(SIGABRT, &sa, NULL);
55 buf = assemble_msg(&test_msg_1, &len, 0);
57 msg = rfc822_start(NULL, buf, len);
59 (void) rfc822_next_header(msg, NULL);
61 /* We should never get here! */