diff --git a/daemonize/src/lib.rs b/daemonize/src/lib.rs index 4f0f758c..60489a3d 100644 --- a/daemonize/src/lib.rs +++ b/daemonize/src/lib.rs @@ -354,6 +354,8 @@ impl Daemonize { Ok(Some(first_child_pid)) => { Outcome::Parent(match waitpid(first_child_pid) { Err(err) => Err(err.into()), + // return value of `waitpid` may not be i32 on all platforms. + #[allow(clippy::unnecessary_cast)] Ok(first_child_exit_code) => Ok(Parent { first_child_exit_code: first_child_exit_code as i32 }), }) }, @@ -498,7 +500,7 @@ unsafe fn get_group(group: Group) -> Result { } unsafe fn set_group(group: libc::gid_t) -> Result<(), ErrorKind> { - check_err(libc::setgid(group), ErrorKind::SetGroup)?; + check_err(libc::setregid(group, group), ErrorKind::SetGroup)?; Ok(()) } @@ -516,7 +518,7 @@ unsafe fn get_user(user: User) -> Result { } unsafe fn set_user(user: libc::uid_t) -> Result<(), ErrorKind> { - check_err(libc::setuid(user), ErrorKind::SetUser)?; + check_err(libc::setreuid(user, user), ErrorKind::SetUser)?; Ok(()) }