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.cute-signatures
parent
000dfd923f
commit
8a4371ccd7
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue