summaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-06-17 16:33:59 +0300
committerTimo Teräs <timo.teras@iki.fi>2013-06-17 16:33:59 +0300
commit92764088a2b09d4e322d21e769ecb51bb5f3b17c (patch)
tree9845b8b8c518523b933dab1dc54806945dbf1d54 /src/cache.c
parent557d360c7f1f7f48fa13fd5dbe0182b63d9e7eca (diff)
downloadapk-tools-92764088a2b09d4e322d21e769ecb51bb5f3b17c.tar.gz
apk-tools-92764088a2b09d4e322d21e769ecb51bb5f3b17c.tar.bz2
apk-tools-92764088a2b09d4e322d21e769ecb51bb5f3b17c.tar.xz
apk-tools-92764088a2b09d4e322d21e769ecb51bb5f3b17c.zip
db, cache: do not use cache/tmp for downloads
instead use prefix for temporary files.
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cache.c b/src/cache.c
index d1ce06e..f25f05a 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -9,6 +9,7 @@
* by the Free Software Foundation. See http://www.gnu.org/ for details.
*/
+#include <fcntl.h>
#include <errno.h>
#include <stdio.h>
#include <dirent.h>
@@ -78,8 +79,10 @@ static void cache_clean_item(struct apk_database *db, int dirfd, const char *nam
if (apk_verbosity >= 2)
apk_message("deleting %s", name);
- if (!(apk_flags & APK_SIMULATE))
- unlinkat(dirfd, name, 0);
+ if (!(apk_flags & APK_SIMULATE)) {
+ if (unlinkat(dirfd, name, 0) < 0 && errno == EISDIR)
+ unlinkat(dirfd, name, AT_REMOVEDIR);
+ }
}
static int cache_clean(struct apk_database *db)