diff options
author | Timo Teräs <timo.teras@iki.fi> | 2013-06-17 16:33:59 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2013-06-17 16:33:59 +0300 |
commit | 92764088a2b09d4e322d21e769ecb51bb5f3b17c (patch) | |
tree | 9845b8b8c518523b933dab1dc54806945dbf1d54 /src/cache.c | |
parent | 557d360c7f1f7f48fa13fd5dbe0182b63d9e7eca (diff) | |
download | apk-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.c | 7 |
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) |