🔬 This is a nightly-only experimental API. (
unix_chown
#88989)
This is supported on Unix only.
Expand description
更改指定打开文件描述符引用的文件的所有者和组。
有关语义和所需权限,请参见 chown
。
#![feature(unix_chown)]
use std::os::unix::fs;
fn main() -> std::io::Result<()> {
let f = std::fs::File::open("/file")?;
fs::fchown(f, Some(0), Some(0))?;
Ok(())
}
Run