composepost: fix fchmod flags for tmpdir (glibc compat)

The `AT_SYMLINK_NOFOLLOW` flag for chmod was not implemented in glibc
until very recent releases (v2.32 in 2020-08).
Before that version, passing this flag will always result in `ENOTSUP`.

Refs:
 * https://github.com/bminor/glibc/blob/glibc-2.31/sysdeps/unix/sysv/linux/fchmodat.c#L36
 * https://github.com/bminor/glibc/blob/glibc-2.32/sysdeps/unix/sysv/linux/fchmodat.c
This commit is contained in:
Luca BRUNO 2021-04-28 12:05:46 +00:00
parent c708b47fc9
commit 6c75f57766
No known key found for this signature in database
GPG Key ID: A9834A2252078E4E

View File

@ -78,7 +78,7 @@ fn compose_init_rootfs(rootfs_dfd: &openat::Dir, tmp_is_dir: bool) -> Result<()>
Some(nix_rootfs.as_raw_fd()),
"tmp",
Mode::from_bits(tmp_mode).unwrap(),
nix::sys::stat::FchmodatFlags::NoFollowSymlink,
nix::sys::stat::FchmodatFlags::FollowSymlink,
)?;
} else {
rootfs_dfd.symlink("tmp", "sysroot/tmp")?;