aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2018-12-20 20:44:35 +0100
committerFabian Groffen <grobian@gentoo.org>2018-12-20 20:44:35 +0100
commitfb74fe22e3eb430ff28bbd884d2ef1546f891051 (patch)
tree0e949ac89f6a5b27715e10dd37555be0d359bb7a
parenttests/mkdir: fix after changes to rm_rf_at (diff)
downloadportage-utils-fb74fe22e3eb430ff28bbd884d2ef1546f891051.tar.gz
portage-utils-fb74fe22e3eb430ff28bbd884d2ef1546f891051.tar.bz2
portage-utils-fb74fe22e3eb430ff28bbd884d2ef1546f891051.zip
rm_rf: make shallow wrapper around rm_rf_at
Since rm_rf_at now removes the object being pointed at, rm_rf doesn't have to try doing that again. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r--libq/xmkdir.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/libq/xmkdir.c b/libq/xmkdir.c
index ed30d6d..aa93905 100644
--- a/libq/xmkdir.c
+++ b/libq/xmkdir.c
@@ -89,18 +89,7 @@ rm_rf_at(int dfd, const char *path)
static int
rm_rf(const char *path)
{
- rm_rf_at(AT_FDCWD, path);
-
- if (rmdir(path) == 0)
- return 0;
-
- /* if path is a symlink, unlink it */
- if (unlink(path) == 0)
- return 0;
-
- /* XXX: we don't handle:
- * trailing slashes: `rm -rf a/b/c/` -> need to change to a/b/c */
- return -1;
+ return rm_rf_at(AT_FDCWD, path);
}
static int