]> git.ozlabs.org Git - ccan/blobdiff - ccan/failtest/failtest.c
failtest: report failpath problems correctly.
[ccan] / ccan / failtest / failtest.c
index 1dad0864aa372fa3b7ead07a081f9e125f192bbc..a0c825399d03881ab0338075a0a46fb2c4ec1898 100644 (file)
@@ -488,7 +488,10 @@ static NORETURN void failtest_cleanup(bool forced_cleanup, int status)
        }
 
        free_everything();
-       tell_parent(SUCCESS);
+       if (status == 0)
+               tell_parent(SUCCESS);
+       else
+               tell_parent(FAILURE);
        exit(status);
 }
 
@@ -515,8 +518,8 @@ static bool should_fail(struct failtest_call *call)
                } else {
                        if (tolower((unsigned char)*failpath)
                            != info_to_arg[call->type])
-                               errx(1, "Failpath expected '%c' got '%c'\n",
-                                    info_to_arg[call->type], *failpath);
+                               errx(1, "Failpath expected '%s' got '%c'\n",
+                                    failpath, info_to_arg[call->type]);
                        call->fail = cisupper(*(failpath++));
                        return call->fail;
                }