summaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0001-db-remount-read-only-after-the-file-handles-have-bee.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2011-05-27 14:01:15 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2011-05-27 14:01:15 +0000
commitbae2bf4baba677c57de6f9bc086c2ce9693b349b (patch)
treeeccfa52ce7ac10f4b98742807a619ea04f6840e8 /main/apk-tools/0001-db-remount-read-only-after-the-file-handles-have-bee.patch
parent9be2ab52dcb8e6f2863a79374e995db437fb6240 (diff)
downloadaports-bae2bf4baba677c57de6f9bc086c2ce9693b349b.tar.bz2
aports-bae2bf4baba677c57de6f9bc086c2ce9693b349b.tar.xz
main/apk-tools: misc fixes for apk cache and remount rw/ro
ref #663 ref #662
Diffstat (limited to 'main/apk-tools/0001-db-remount-read-only-after-the-file-handles-have-bee.patch')
-rw-r--r--main/apk-tools/0001-db-remount-read-only-after-the-file-handles-have-bee.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/main/apk-tools/0001-db-remount-read-only-after-the-file-handles-have-bee.patch b/main/apk-tools/0001-db-remount-read-only-after-the-file-handles-have-bee.patch
new file mode 100644
index 000000000..45b75a332
--- /dev/null
+++ b/main/apk-tools/0001-db-remount-read-only-after-the-file-handles-have-bee.patch
@@ -0,0 +1,45 @@
+From 38e54240a38266c0c1864e51e4ca7468a429646e Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Fri, 27 May 2011 11:38:50 +0000
+Subject: [PATCH 1/2] db: remount read-only after the file handles have been
+ closed
+
+The apk cache might be on the readonly media so we need wait with
+remounting til after atleast this filehandle is closed.
+---
+ src/database.c | 12 ++++++------
+ 1 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/database.c b/src/database.c
+index 1d4c573..0fc59df 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1397,12 +1397,6 @@ void apk_db_close(struct apk_database *db)
+ struct hlist_node *dc, *dn;
+ int i;
+
+- if (db->cache_remount_dir) {
+- do_remount(db->cache_remount_dir, "ro");
+- free(db->cache_remount_dir);
+- db->cache_remount_dir = NULL;
+- }
+-
+ apk_id_cache_free(&db->id_cache);
+
+ list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list) {
+@@ -1436,6 +1430,12 @@ void apk_db_close(struct apk_database *db)
+ close(db->lock_fd);
+ if (db->root != NULL)
+ free(db->root);
++
++ if (db->cache_remount_dir) {
++ do_remount(db->cache_remount_dir, "ro");
++ free(db->cache_remount_dir);
++ db->cache_remount_dir = NULL;
++ }
+ }
+
+ static int fire_triggers(apk_hash_item item, void *ctx)
+--
+1.7.5.2
+