9 #define CCAN_RFC822_DEBUG
11 #include <ccan/rfc822/rfc822.h>
14 #include <ccan/tal/talloc/talloc.h>
16 #include <ccan/tal/tal.h>
19 static bool should_fail = false;
21 static void *mayfail_alloc(const void *ctx, size_t size)
25 return tal_arrz(ctx, char, size);
28 /* Override various tallocation functions. */
32 #define tal(ctx, type) mayfail_alloc((ctx), sizeof(type))
33 #define talz(ctx, type) mayfail_alloc((ctx), sizeof(type))
34 #define tal_arr(ctx, type, num) mayfail_alloc((ctx), sizeof(type)*(num))
36 #include <ccan/rfc822/rfc822.c>
40 static void abort_handler(int signum)
46 int main(int argc, char *argv[])
50 struct rfc822_msg *msg;
51 struct sigaction sa = {
52 .sa_handler = abort_handler,
56 ret = sigaction(SIGABRT, &sa, NULL);
59 buf = assemble_msg(&test_msg_1, &len, 0);
61 msg = rfc822_start(NULL, buf, len);
63 (void) rfc822_next_header(msg, NULL);
65 /* We should never get here! */