summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/database.c6
-rw-r--r--src/io.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/src/database.c b/src/database.c
index 16f8bb8..5b1d6bb 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1810,7 +1810,7 @@ static void apk_db_purge_pkg(struct apk_database *db,
if (!(diri->dir->flags & APK_DBDIRF_PROTECTED) ||
(apk_flags & APK_PURGE) ||
(file->csum.type != APK_CHECKSUM_NONE &&
- apk_file_get_info(db->root_fd, name, file->csum.type, &fi) == 0 &&
+ apk_file_get_info(db->root_fd, name, APK_FI_NOFOLLOW | file->csum.type, &fi) == 0 &&
apk_checksum_compare(&file->csum, &fi.csum) == 0))
unlinkat(db->root_fd, name, 0);
if (apk_verbosity >= 3)
@@ -1868,6 +1868,7 @@ static void apk_db_migrate_files(struct apk_database *db,
if (ofile != NULL &&
(diri->dir->flags & APK_DBDIRF_PROTECTED))
cstype = ofile->csum.type;
+ cstype |= APK_FI_NOFOLLOW;
r = apk_file_get_info(db->root_fd, name, cstype, &fi);
if ((diri->dir->flags & APK_DBDIRF_PROTECTED) &&
@@ -1882,7 +1883,8 @@ static void apk_db_migrate_files(struct apk_database *db,
* existing file */
if (ofile == NULL ||
ofile->csum.type != file->csum.type)
- apk_file_get_info(db->root_fd, name, file->csum.type, &fi);
+ apk_file_get_info(db->root_fd, name,
+ APK_FI_NOFOLLOW | file->csum.type, &fi);
if ((apk_flags & APK_CLEAN_PROTECTED) ||
(file->csum.type != APK_CHECKSUM_NONE &&
apk_checksum_compare(&file->csum, &fi.csum) == 0))
diff --git a/src/io.c b/src/io.c
index 40590a2..3e292a7 100644
--- a/src/io.c
+++ b/src/io.c
@@ -487,7 +487,7 @@ int apk_file_get_info(int atfd, const char *filename, unsigned int flags,
.device = st.st_dev,
};
- if (checksum == APK_CHECKSUM_NONE)
+ if (checksum == APK_CHECKSUM_NONE || S_ISDIR(st.st_mode))
return 0;
if ((flags & APK_FI_NOFOLLOW) && S_ISLNK(st.st_mode)) {