summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-09-04 10:38:13 +0300
committerTimo Teräs <timo.teras@iki.fi>2012-09-04 10:38:13 +0300
commit8a4371ccd73e8f8672466881bd3b782de919cd93 (patch)
tree49fb7d17651992bb91d5e97b4712d4eb8f4b6c56 /src/database.c
parent000dfd923f512b673c3c77ae78ff732ae72c818f (diff)
downloadapk-tools-8a4371ccd73e8f8672466881bd3b782de919cd93.tar.gz
apk-tools-8a4371ccd73e8f8672466881bd3b782de919cd93.tar.bz2
apk-tools-8a4371ccd73e8f8672466881bd3b782de919cd93.tar.xz
apk-tools-8a4371ccd73e8f8672466881bd3b782de919cd93.zip
db: remove AT_SYMLINK_NOFOLLOW for directory permissions
fchmodat does not support this flag - symlinks do not have permissions. Sysadmin probably does not expect us to not follow symlinks either: if /var -> /mnt/foo/var, we should be making sure the permissions and ownership is correct on the target directory, not on the symlink. Since fchmodat never returned ENOENT with AT_SYMLINK_NOFOLLOW, this also fixes directory re-creation if it does not exist. fixes #1348.
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 efff29f..d1a8f1a 100644
--- a/src/database.c
+++ b/src/database.c
@@ -229,11 +229,11 @@ static void apk_db_dir_mkdir(struct apk_database *db, struct apk_db_dir *dir)
return;
if ((dir->refs == 1) ||
- (fchmodat(db->root_fd, dir->name, dir->mode, AT_SYMLINK_NOFOLLOW) != 0 &&
+ (fchmodat(db->root_fd, dir->name, dir->mode, 0) != 0 &&
errno == ENOENT))
if ((mkdirat(db->root_fd, dir->name, dir->mode) != 0 &&
errno == EEXIST))
- if (fchmodat(db->root_fd, dir->name, dir->mode, AT_SYMLINK_NOFOLLOW) != 0)
+ if (fchmodat(db->root_fd, dir->name, dir->mode, 0) != 0)
;
if (fchownat(db->root_fd, dir->name, dir->uid, dir->gid, 0) != 0)