summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-11-03 13:36:11 +0200
committerTimo Teräs <timo.teras@iki.fi>2014-11-03 14:56:07 +0200
commitf726e672c067b996426d0885d8b173c0c36faf1f (patch)
tree0c64240e887a0a021c58de731627b09a38166b06 /src/database.c
parentb80aba0b5a687436a5577bbd81e4eb8fb56298a8 (diff)
downloadapk-tools-f726e672c067b996426d0885d8b173c0c36faf1f.tar.gz
apk-tools-f726e672c067b996426d0885d8b173c0c36faf1f.tar.bz2
apk-tools-f726e672c067b996426d0885d8b173c0c36faf1f.tar.xz
apk-tools-f726e672c067b996426d0885d8b173c0c36faf1f.zip
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.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c4
1 files 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) {