commit: 0e291a9ff5aef406d53b5a324356fc77ddd4b8e7
parent 9538308a9b30aa138781607a4cc01d84233164fb
Author: Michael Forney <mforney@mforney.org>
Date: Wed, 27 Mar 2019 19:51:04 -0700
applyperms: Print when removing directories
Also, make sure to remove them relative to rootfd.
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/applyperms.c b/src/applyperms.c
@@ -174,6 +174,13 @@ mkdir_v(const char *path, mode_t mode)
}
static int
+rmdir_v(const char *path)
+{
+ printf("rmdir(\"%s\")\n", path);
+ return unlinkat(rootfd, path, AT_REMOVEDIR);
+}
+
+static int
defperm(const char *name)
{
struct stat st;
@@ -265,7 +272,7 @@ specialperms(void)
/* delete directories in reverse order */
while (i > 0) {
--i;
- if (oldsp.perms[i].delete && rmdir(oldsp.perms[i].name) < 0) {
+ if (oldsp.perms[i].delete && rmdir_v(oldsp.perms[i].name) < 0) {
switch (errno) {
case ENOENT:
case ENOTEMPTY: