Skip to content

Commit

Permalink
Stabilize chown functions (unix_chown)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
JohnTitor committed Jun 25, 2023
1 parent a976ed6 commit 4cc63f6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions std/src/os/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,14 @@ impl DirBuilderExt for fs::DirBuilder {
/// # Examples
///
/// ```no_run
/// #![feature(unix_chown)]
/// use std::os::unix::fs;
///
/// fn main() -> std::io::Result<()> {
/// fs::chown("/sandbox", Some(0), Some(0))?;
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_chown", issue = "88989")]
#[stable(feature = "unix_chown", since = "CURRENT_RUSTC_VERSION")]
pub fn chown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
sys::fs::chown(dir.as_ref(), uid.unwrap_or(u32::MAX), gid.unwrap_or(u32::MAX))
}
Expand All @@ -991,7 +990,6 @@ pub fn chown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::
/// # Examples
///
/// ```no_run
/// #![feature(unix_chown)]
/// use std::os::unix::fs;
///
/// fn main() -> std::io::Result<()> {
Expand All @@ -1000,7 +998,7 @@ pub fn chown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_chown", issue = "88989")]
#[stable(feature = "unix_chown", since = "CURRENT_RUSTC_VERSION")]
pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
sys::fs::fchown(fd.as_fd().as_raw_fd(), uid.unwrap_or(u32::MAX), gid.unwrap_or(u32::MAX))
}
Expand All @@ -1013,15 +1011,14 @@ pub fn fchown<F: AsFd>(fd: F, uid: Option<u32>, gid: Option<u32>) -> io::Result<
/// # Examples
///
/// ```no_run
/// #![feature(unix_chown)]
/// use std::os::unix::fs;
///
/// fn main() -> std::io::Result<()> {
/// fs::lchown("/symlink", Some(0), Some(0))?;
/// Ok(())
/// }
/// ```
#[unstable(feature = "unix_chown", issue = "88989")]
#[stable(feature = "unix_chown", since = "CURRENT_RUSTC_VERSION")]
pub fn lchown<P: AsRef<Path>>(dir: P, uid: Option<u32>, gid: Option<u32>) -> io::Result<()> {
sys::fs::lchown(dir.as_ref(), uid.unwrap_or(u32::MAX), gid.unwrap_or(u32::MAX))
}
Expand Down

0 comments on commit 4cc63f6

Please sign in to comment.