1.1 --- a/libe2access/host/e2access.c Wed Feb 16 00:02:37 2022 +0100
1.2 +++ b/libe2access/host/e2access.c Wed Feb 16 01:25:39 2022 +0100
1.3 @@ -574,11 +574,11 @@
1.4 return 1;
1.5 }
1.6
1.7 - /* Remove the directory. */
1.8 + /* Test for an empty directory. */
1.9
1.10 - if (image_remove_by_path(fs, path))
1.11 + if (image_dir_empty_by_path(fs, path, &ino))
1.12 {
1.13 - fprintf(stderr, "Could not remove directory: %s\n", path);
1.14 + fprintf(stderr, "Directory not empty: %s\n", path);
1.15 return 1;
1.16 }
1.17
1.18 @@ -589,6 +589,14 @@
1.19 fprintf(stderr, "Could not unlink directory: %s\n", path);
1.20 return 1;
1.21 }
1.22 +
1.23 + /* Remove the directory. */
1.24 +
1.25 + if (image_remove_by_inode(fs, ino))
1.26 + {
1.27 + fprintf(stderr, "Could not remove directory: %s\n", path);
1.28 + return 1;
1.29 + }
1.30 }
1.31
1.32 return 0;