diff --git a/src/dnode/src/dnodeMain.c b/src/dnode/src/dnodeMain.c index ea0ef4655d4cc98949012f125d9805ac20642d1a..410e6bb1888a11858e5d091f3f82c54df4dc2022 100644 --- a/src/dnode/src/dnodeMain.c +++ b/src/dnode/src/dnodeMain.c @@ -238,9 +238,11 @@ static int32_t dnodeInitStorage() { } TDIR *tdir = tfsOpendir("vnode_bak/.staging"); - if (tfsReaddir(tdir) != NULL) { + bool stagingNotEmpty = tfsReaddir(tdir) != NULL; + tfsClosedir(tdir); + + if (stagingNotEmpty) { dError("vnode_bak/.staging dir not empty, fix it first."); - tfsClosedir(tdir); return -1; }