diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-05-27 11:38:50 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-05-27 11:38:50 +0000 |
commit | 38e54240a38266c0c1864e51e4ca7468a429646e (patch) | |
tree | d5693785fdc9a0d1413311b8096c6acfaa348e7a /src/database.c | |
parent | 2332d991a140086d35aebef59ff9c4eec12e5aa9 (diff) | |
download | apk-tools-38e54240a38266c0c1864e51e4ca7468a429646e.tar.gz apk-tools-38e54240a38266c0c1864e51e4ca7468a429646e.tar.bz2 apk-tools-38e54240a38266c0c1864e51e4ca7468a429646e.tar.xz apk-tools-38e54240a38266c0c1864e51e4ca7468a429646e.zip |
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.
Diffstat (limited to 'src/database.c')
-rw-r--r-- | 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) |