]> git.ozlabs.org Git - ccan/commitdiff
failtest: replay --failpath correctly on really failing opens.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 29 Aug 2011 23:52:39 +0000 (09:22 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 29 Aug 2011 23:52:39 +0000 (09:22 +0930)
When an open() call fails, we don't inject an error, but we didn't
apply this logic when replaying a failpath, with strange results.

ccan/failtest/failtest.c

index bac0aa350ac24378e8af2b949cb0781a7699906a..f79768d87877f3ff7c8d6a3865842c0a3ee85ceb 100644 (file)
@@ -701,7 +701,7 @@ int failtest_open(const char *pathname,
                free((char *)call.pathname);
        p->u.open.ret = open(pathname, call.flags, call.mode);
 
                free((char *)call.pathname);
        p->u.open.ret = open(pathname, call.flags, call.mode);
 
-       if (!failpath && p->u.open.ret == -1) {
+       if (p->u.open.ret == -1) {
                p->fail = false;
                p->error = errno;
        } else if (should_fail(p)) {
                p->fail = false;
                p->error = errno;
        } else if (should_fail(p)) {