dir: dtest should flush on error when creating directories 96/13796/6
authorMark Vitale <mvitale@sinenomine.net>
Wed, 6 Mar 2019 16:27:58 +0000 (11:27 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 8 Oct 2020 04:15:27 +0000 (00:15 -0400)
The dtest -f subcommand (CRTest()) exits immediately if there is an
error while adding files.  This may create an empty, incomplete, or
corrupt directory object on disk because we neglected to call DFlush
before exiting.

Always call DFlush from CRTest() whether it fails or succeeds.

Change-Id: Ia7b4ad00ea6f4f9f788cd75ae726bdadb60ee9c3
Reviewed-on: https://gerrit.openafs.org/13796
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/dir/test/dtest.c

index e6e3875..20eeb5a 100644 (file)
@@ -158,7 +158,7 @@ CRTest(char *dname, char *ename, int count)
        }
        if (code) {
            printf("code for '%s' is %d\n", tbuffer, code);
-           return;
+           break;
        }
     }
     DFlush();