src/open_by_handle: verify dir content only with -r flag
[xfstests-dev.git] / src / open_by_handle.c
index dbc5b0f4d0affad8e632ccd92aedeb3f803431aa..9c13b2ab072b8173d6592bb5ddfbf775119013b2 100644 (file)
@@ -412,7 +412,7 @@ int main(int argc, char **argv)
                        if (!nlink) {
                                printf("open_by_handle(%s) opened an unlinked dir!\n", dname);
                                return EXIT_FAILURE;
-                       } else {
+                       } else if (rd) {
                                /*
                                 * Sanity check dir fd - expect to access orig file IFF
                                 * it was not unlinked nor renamed.