aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2018-12-20 20:58:18 +0100
committerFabian Groffen <grobian@gentoo.org>2018-12-20 20:58:18 +0100
commit5539ab9cf34f303b7e11c5989d8cde8f1ed57043 (patch)
tree8cb3afeec8fba3092b3cb729f9b048b0f33f9ec2
parentrm_rf: make shallow wrapper around rm_rf_at (diff)
downloadportage-utils-5539ab9cf34f303b7e11c5989d8cde8f1ed57043.tar.gz
portage-utils-5539ab9cf34f303b7e11c5989d8cde8f1ed57043.tar.bz2
portage-utils-5539ab9cf34f303b7e11c5989d8cde8f1ed57043.zip
rm_rf_at: ensure return code makes sensev0.74
Don't blindly ignore errors, just run statements that should succeed and register success. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--libq/xmkdir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libq/xmkdir.c b/libq/xmkdir.c
index aa93905..bc89fe0 100644
--- a/libq/xmkdir.c
+++ b/libq/xmkdir.c
@@ -49,6 +49,7 @@ rm_rf_at(int dfd, const char *path)
int subdfd;
DIR *dir;
struct dirent *de;
+ int ret = 0;
/* Cannot use O_PATH as we want to use fdopendir() */
subdfd = openat(dfd, path, O_RDONLY|O_CLOEXEC|O_NOFOLLOW);
@@ -73,17 +74,16 @@ rm_rf_at(int dfd, const char *path)
!(st.st_mode & S_IFDIR))
errp("could not unlink %s", de->d_name);
}
- rm_rf_at(subdfd, de->d_name);
- unlinkat(subdfd, de->d_name, AT_REMOVEDIR);
+ ret |= rm_rf_at(subdfd, de->d_name);
}
}
- unlinkat(dfd, path, AT_REMOVEDIR);
+ ret |= unlinkat(dfd, path, AT_REMOVEDIR);
/* this also does close(subdfd); */
closedir(dir);
- return 0;
+ return ret;
}
static int