diff options
author | Timo Teräs <timo.teras@iki.fi> | 2020-10-02 15:25:12 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-10-09 16:09:19 +0300 |
commit | 6d71f49c11e22a617234ef47123ab9287cde23af (patch) | |
tree | 320b27af8e13815cdb8e5e458de74a9b343a0f1a /src/database.c | |
parent | 2156107afcd1954fd36ab1e55cf73390548e6d07 (diff) | |
download | apk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.tar.gz apk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.tar.bz2 apk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.tar.xz apk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.zip |
io: make ostream_file always use tmpname
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/src/database.c b/src/database.c index 8298f72..9d1c82b 100644 --- a/src/database.c +++ b/src/database.c @@ -53,23 +53,13 @@ unsigned int apk_flags = 0, apk_force = 0; static apk_blob_t tmpprefix = { .len=8, .ptr = ".apknew." }; static const char * const apkindex_tar_gz = "APKINDEX.tar.gz"; - static const char * const apk_static_cache_dir = "var/cache/apk"; - static const char * const apk_world_file = "etc/apk/world"; -static const char * const apk_world_file_tmp = "etc/apk/world.new"; static const char * const apk_arch_file = "etc/apk/arch"; - static const char * const apk_lock_file = "lib/apk/db/lock"; - static const char * const apk_scripts_file = "lib/apk/db/scripts.tar"; -static const char * const apk_scripts_file_tmp = "lib/apk/db/scripts.tar.new"; - static const char * const apk_triggers_file = "lib/apk/db/triggers"; -static const char * const apk_triggers_file_tmp = "lib/apk/db/triggers.new"; - const char * const apk_installed_file = "lib/apk/db/installed"; -static const char * const apk_installed_file_tmp = "lib/apk/db/installed.new"; static struct apk_db_acl *apk_default_acl_dir, *apk_default_acl_file; @@ -1221,10 +1211,7 @@ static int apk_db_index_write_nr_cache(struct apk_database *db) /* Write list of installed non-repository packages to * cached index file */ - os = apk_ostream_to_file(db->cache_fd, - "installed", - "installed.new", - 0644); + os = apk_ostream_to_file(db->cache_fd, "installed", 0644); if (IS_ERR_OR_NULL(os)) return PTR_ERR(os); ctx.os = os; @@ -1767,29 +1754,20 @@ int apk_db_write_config(struct apk_database *db) return -1; } - os = apk_ostream_to_file(db->root_fd, - apk_world_file, - apk_world_file_tmp, - 0644); + os = apk_ostream_to_file(db->root_fd, apk_world_file, 0644); if (IS_ERR_OR_NULL(os)) return PTR_ERR(os); apk_deps_write(db, db->world, os, APK_BLOB_PTR_LEN("\n", 1)); apk_ostream_write(os, "\n", 1); r = apk_ostream_close(os); if (r < 0) return r; - os = apk_ostream_to_file(db->root_fd, - apk_installed_file, - apk_installed_file_tmp, - 0644); + os = apk_ostream_to_file(db->root_fd, apk_installed_file, 0644); if (IS_ERR_OR_NULL(os)) return PTR_ERR(os); apk_db_write_fdb(db, os); r = apk_ostream_close(os); if (r < 0) return r; - os = apk_ostream_to_file(db->root_fd, - apk_scripts_file, - apk_scripts_file_tmp, - 0644); + os = apk_ostream_to_file(db->root_fd, apk_scripts_file, 0644); if (IS_ERR_OR_NULL(os)) return PTR_ERR(os); apk_db_scriptdb_write(db, os); r = apk_ostream_close(os); @@ -1797,10 +1775,7 @@ int apk_db_write_config(struct apk_database *db) apk_db_index_write_nr_cache(db); - os = apk_ostream_to_file(db->root_fd, - apk_triggers_file, - apk_triggers_file_tmp, - 0644); + os = apk_ostream_to_file(db->root_fd, apk_triggers_file, 0644); if (IS_ERR_OR_NULL(os)) return PTR_ERR(os); apk_db_triggers_write(db, os); r = apk_ostream_close(os); |