diff options
author | Timo Teräs <timo.teras@iki.fi> | 2011-03-16 15:39:36 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2011-03-16 15:39:36 +0200 |
commit | 2222a15eddad9c5fac8d032f51f65811c0947495 (patch) | |
tree | b3721762d1304aafdc3114074cbb878c033478c4 /src/database.c | |
parent | 20775276b934418ba451f76c9c8a24418201fa66 (diff) | |
download | apk-tools-2222a15eddad9c5fac8d032f51f65811c0947495.tar.gz apk-tools-2222a15eddad9c5fac8d032f51f65811c0947495.tar.bz2 apk-tools-2222a15eddad9c5fac8d032f51f65811c0947495.tar.xz apk-tools-2222a15eddad9c5fac8d032f51f65811c0947495.zip |
db: move lock file to /var/lock
in accordance with FSH. this also to clear /var of apk related things
as we might want to run /var as harddisk, but rest of system from
ramdisk.
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/database.c b/src/database.c index 21b266b..6f00aa1 100644 --- a/src/database.c +++ b/src/database.c @@ -54,6 +54,7 @@ const char *apk_arch = APK_DEFAULT_ARCH; const char * const apkindex_tar_gz = "APKINDEX.tar.gz"; static const char * const apk_static_cache_dir = "var/lib/apk"; static const char * const apk_linked_cache_dir = "etc/apk/cache"; +static const char * const apk_lock_file = "var/lock/apkdb"; struct install_ctx { struct apk_database *db; @@ -1051,6 +1052,7 @@ static int apk_db_create(struct apk_database *db) mkdirat(db->root_fd, "var/lib/apk", 0755); mkdirat(db->root_fd, "var/cache", 0755); mkdirat(db->root_fd, "var/cache/misc", 0755); + mkdirat(db->root_fd, "var/lock", 0755); fd = openat(db->root_fd, "var/lib/apk/world", O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC, 0644); if (fd < 0) @@ -1162,7 +1164,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) apk_id_cache_init(&db->id_cache, db->root_fd); if (dbopts->open_flags & APK_OPENF_WRITE) { - db->lock_fd = openat(db->root_fd, "var/lib/apk/lock", + db->lock_fd = openat(db->root_fd, apk_lock_file, O_CREAT | O_RDWR | O_CLOEXEC, 0400); if (db->lock_fd < 0 && errno == ENOENT && (dbopts->open_flags & APK_OPENF_CREATE)) { @@ -1171,7 +1173,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) msg = "Unable to create database"; goto ret_r; } - db->lock_fd = openat(db->root_fd, "var/lib/apk/lock", + db->lock_fd = openat(db->root_fd, apk_lock_file, O_CREAT | O_RDWR | O_CLOEXEC, 0400); } if (db->lock_fd < 0 || |