Commit 98de5353 authored by Timo Teräs's avatar Timo Teräs

archive: overwrite protection needs to use real filename

otherwise we always extract the file as .apk-new and the database
side just overwrites.
parent 4dd183f3
......@@ -344,8 +344,14 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae,
(ae->link_target != NULL)) {
/* non-standard entries need to be deleted first */
if (apk_flags & APK_NEVER_OVERWRITE) {
if (faccessat(atfd, fn, F_OK, AT_SYMLINK_NOFOLLOW) == 0)
if (faccessat(atfd, ae->name, F_OK,
AT_SYMLINK_NOFOLLOW) == 0) {
/* destination exists, but we are not supposed
* to overwrite, just clean the temp file */
if (suffix != NULL)
unlinkat(atfd, fn, 0);
return 0;
}
} else {
unlinkat(atfd, fn, 0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment