tal: save and restore errno across all notifiers.
[ccan] / ccan / tal / test / run-free.c
index f21264748d40a056a7e1ae5ed1d0976190d86e5a..37d03cd6ff4cbd0233950f0808129e939f9975e1 100644 (file)
@@ -4,6 +4,8 @@
 
 static void destroy_errno(char *p UNNEEDED)
 {
+       /* Errno restored for all the destructors. */
+       ok1(errno == EINVAL);
        errno = ENOENT;
 }
 
@@ -11,10 +13,11 @@ 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;