Function creusot_contracts::std::os::unix::fs::fchown

1.73.0 · source ·
pub fn fchown<F>(fd: F, uid: Option<u32>, gid: Option<u32>) -> Result<(), Error>
where F: AsFd,
Available on Unix only.
Expand description

Change the owner and group of the file referenced by the specified open file descriptor.

For semantics and required privileges, see chown.

§Examples

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(())
}