From f726e672c067b996426d0885d8b173c0c36faf1f Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Mon, 3 Nov 2014 13:36:11 +0200 Subject: db: assign write permission to lock file Allows running apk as an unprivileged user, e.g. with fakeroot. Opening the lock file fails without the write permission. --- src/database.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/database.c b/src/database.c index b763c43..e35c127 100644 --- a/src/database.c +++ b/src/database.c @@ -1513,7 +1513,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) relocate_database(db); db->lock_fd = openat(db->root_fd, apk_lock_file, - O_CREAT | O_RDWR | O_CLOEXEC, 0400); + O_CREAT | O_RDWR | O_CLOEXEC, 0600); if (db->lock_fd < 0 && errno == ENOENT && (dbopts->open_flags & APK_OPENF_CREATE)) { r = apk_db_create(db); @@ -1522,7 +1522,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) goto ret_r; } db->lock_fd = openat(db->root_fd, apk_lock_file, - O_CREAT | O_RDWR | O_CLOEXEC, 0400); + O_CREAT | O_RDWR | O_CLOEXEC, 0600); } if (db->lock_fd < 0 || flock(db->lock_fd, LOCK_EX | LOCK_NB) < 0) { -- cgit v1.2.3-70-g09d2