Skip to content

Commit

Permalink
add android to the target OS for setfsuid and setfsgid, and remove in…
Browse files Browse the repository at this point in the history
…line attribute
  • Loading branch information
Marco Conte committed Jan 27, 2020
1 parent 4fdc578 commit 73b4c51
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/unistd.rs
Expand Up @@ -1398,25 +1398,23 @@ pub fn setgid(gid: Gid) -> Result<()> {
Errno::result(res).map(drop)
}

/// Set the user identity used for filesystem checks.
/// Set the user identity used for filesystem checks per-thread.
/// On both success and failure, this call returns the previous filesystem user
/// ID of the caller.
///
/// See also [setfsuid(2)](http://man7.org/linux/man-pages/man2/setfsuid.2.html)
#[cfg(target_os = "linux")]
#[inline]
#[cfg(any(target_os = "linux", target_os = "android"))]
pub fn setfsuid(uid: Uid) -> Uid {
let prev_fsuid = unsafe { libc::setfsuid(uid.into()) };
Uid::from_raw(prev_fsuid as uid_t)
}

/// Set the group identity used for filesystem checks.
/// Set the group identity used for filesystem checks per-thread.
/// On both success and failure, this call returns the previous filesystem group
/// ID of the caller.
///
/// See also [setfsgid(2)](http://man7.org/linux/man-pages/man2/setfsgid.2.html)
#[cfg(target_os = "linux")]
#[inline]
#[cfg(any(target_os = "linux", target_os = "android"))]
pub fn setfsgid(gid: Gid) -> Gid {
let prev_fsgid = unsafe { libc::setfsgid(gid.into()) };
Gid::from_raw(prev_fsgid as gid_t)
Expand Down

0 comments on commit 73b4c51

Please sign in to comment.