From 6417de4d1057675bacc06274cab385810b86eed7 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Mon, 21 Dec 2009 16:53:47 +0200 Subject: apk: remove the unneeded --never-overwrite turns out the logic does not work with overlays as expected due to busybox symlinks being unmanaged. remove the useless option. --- src/apk.c | 4 ---- src/apk_defines.h | 3 +-- src/archive.c | 19 +------------------ src/database.c | 8 +++----- 4 files changed, 5 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/apk.c b/src/apk.c index ee6690f..76c1e4e 100644 --- a/src/apk.c +++ b/src/apk.c @@ -57,7 +57,6 @@ static struct apk_option generic_options[] = { { 0x108, "repositories-file", "Override repositories file", required_argument, "REPOFILE" }, { 0x109, "no-network", "Do not use network (cache is still used)" }, - { 0x110, "never-overwrite", "Never overwrite existing files" }, { 0x111, "overlay-from-stdin", "Read list of overlay files from stdin" }, }; @@ -386,9 +385,6 @@ int main(int argc, char **argv) case 0x109: apk_flags |= APK_NO_NETWORK; break; - case 0x110: - apk_flags |= APK_NEVER_OVERWRITE; - break; case 0x111: apk_flags |= APK_OVERLAY_FROM_STDIN; break; diff --git a/src/apk_defines.h b/src/apk_defines.h index 2e93151..7414159 100644 --- a/src/apk_defines.h +++ b/src/apk_defines.h @@ -64,8 +64,7 @@ extern unsigned int apk_flags; #define APK_INTERACTIVE 0x0400 #define APK_RECURSIVE_DELETE 0x0800 #define APK_NO_NETWORK 0x1000 -#define APK_NEVER_OVERWRITE 0x2000 -#define APK_OVERLAY_FROM_STDIN 0x4000 +#define APK_OVERLAY_FROM_STDIN 0x2000 #define apk_error(args...) do { apk_log("ERROR: ", args); } while (0) #define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log("WARNING: ", args); } } while (0) diff --git a/src/archive.c b/src/archive.c index a2707cd..b27c039 100644 --- a/src/archive.c +++ b/src/archive.c @@ -343,18 +343,7 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae, if ((!S_ISDIR(ae->mode) && !S_ISREG(ae->mode)) || (ae->link_target != NULL)) { /* non-standard entries need to be deleted first */ - if (apk_flags & APK_NEVER_OVERWRITE) { - 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); - } + unlinkat(atfd, fn, 0); } switch (ae->mode & S_IFMT) { @@ -367,14 +356,8 @@ int apk_archive_entry_extract(int atfd, const struct apk_file_info *ae, if (ae->link_target == NULL) { int flags = O_RDWR | O_CREAT | O_TRUNC; - if (apk_flags & APK_NEVER_OVERWRITE) - flags |= O_EXCL; - fd = openat(atfd, fn, flags, ae->mode & 07777); if (fd < 0) { - if ((apk_flags & APK_NEVER_OVERWRITE) && - (errno == EEXIST)) - return 0; r = -1; break; } diff --git a/src/database.c b/src/database.c index fef25f8..debe897 100644 --- a/src/database.c +++ b/src/database.c @@ -1942,11 +1942,9 @@ static void apk_db_migrate_files(struct apk_database *db, apk_checksum_compare(&file->csum, &fi.csum) == 0)) unlinkat(db->root_fd, tmpname, 0); } else { - /* check if want keep existing files */ - if ((ofile->name == NULL) || - ((apk_flags & APK_NEVER_OVERWRITE) && - (faccessat(db->root_fd, name, F_OK, - AT_SYMLINK_NOFOLLOW) == 0))) { + if (ofile->name == NULL) { + /* File was from overlay, delete the + * packages version */ unlinkat(db->root_fd, tmpname, 0); } else { /* Overwrite the old file */ -- cgit v1.2.3