mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-02 00:02:01 +00:00
Merge pull request #10976 from zvonkok/fix-dev-permissions
agent: Fix default linux device permissions
This commit is contained in:
commit
504d9e2b66
@ -1016,10 +1016,17 @@ fn mknod_dev(dev: &LinuxDevice, relpath: &Path) -> Result<()> {
|
||||
None => return Err(anyhow!("invalid spec".to_string())),
|
||||
};
|
||||
|
||||
let file_mode = dev
|
||||
.file_mode()
|
||||
// drop the mode if it is 0
|
||||
.filter(|&m| m != 0)
|
||||
// fall back to 0o666
|
||||
.unwrap_or(0o666);
|
||||
|
||||
stat::mknod(
|
||||
relpath,
|
||||
*f,
|
||||
Mode::from_bits_truncate(dev.file_mode().unwrap_or(0)),
|
||||
Mode::from_bits_truncate(file_mode),
|
||||
nix::sys::stat::makedev(dev.major() as u64, dev.minor() as u64),
|
||||
)?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user