X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftal%2Ftest%2Frun-free.c;h=37d03cd6ff4cbd0233950f0808129e939f9975e1;hp=7b9a086e7c908bfe17b977d696ac0f6c85a0f7fe;hb=9d2d2c49f053018724bcc6e37029da10b7c3d60d;hpb=34c2962d00c4ec24f248bddfd42f2e79cc6b61ef diff --git a/ccan/tal/test/run-free.c b/ccan/tal/test/run-free.c index 7b9a086e..37d03cd6 100644 --- a/ccan/tal/test/run-free.c +++ b/ccan/tal/test/run-free.c @@ -2,8 +2,10 @@ #include #include -static void destroy_errno(char *p) +static void destroy_errno(char *p UNNEEDED) { + /* Errno restored for all the destructors. */ + ok1(errno == EINVAL); errno = ENOENT; } @@ -11,15 +13,17 @@ int main(void) { char *p; - plan_tests(2); + plan_tests(5); p = tal(NULL, char); ok1(tal_add_destructor(p, destroy_errno)); + ok1(tal_add_destructor(p, destroy_errno)); /* Errno save/restored across free. */ errno = EINVAL; tal_free(p); ok1(errno == EINVAL); + tal_cleanup(); return exit_status(); }