priv_sep

Privilege separation library.
git clone https://git.philomathiclife.com/repos/priv_sep
Log | Files | Refs | README

commit 6806c11be86bce6457e7c788ce32c8f068ce2b7d
parent c63d5b114163f56899e75153ee25b475bb623beb
Author: Zack Newman <zack@philomathiclife.com>
Date:   Tue, 30 Sep 2025 22:35:13 -0600

fix on apple targets

Diffstat:
MREADME.md | 4+++-
Msrc/err.rs | 4++--
Msrc/lib.rs | 8+++++++-
3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -126,7 +126,9 @@ at your option. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. -Before any PR is sent, `cargo clippy` and `cargo t` should be run. Additionally +Before any PR is sent, `cargo clippy` and `cargo t` should be run _for each possible combination of "features"_ +using the stable and MSRV toolchains. One easy way to achieve this is by invoking +[`ci-cargo`](https://crates.io/crates/ci-cargo) in the `priv_sep` directory. Additionally, `RUSTDOCFLAGS="--cfg docsrs" cargo +nightly doc --all-features` should be run to ensure documentation can be built. ### Status diff --git a/src/err.rs b/src/err.rs @@ -609,7 +609,7 @@ impl Errno { 42 => Self::ENOPROTOOPT, 43 => Self::EPROTONOSUPPORT, 44 => Self::ESOCKTNOSUPPORT, - 45 => Self::ENOTSUPP, + 45 => Self::ENOTSUP, 46 => Self::EPFNOSUPPORT, 47 => Self::EAFNOSUPPORT, 48 => Self::EADDRINUSE, @@ -1392,7 +1392,7 @@ impl Errno { Self::ENOPROTOOPT => 42, Self::EPROTONOSUPPORT => 43, Self::ESOCKTNOSUPPORT => 44, - Self::ENOTSUPP => 45, + Self::ENOTSUP => 45, Self::EPFNOSUPPORT => 46, Self::EAFNOSUPPORT => 47, Self::EADDRINUSE => 48, diff --git a/src/lib.rs b/src/lib.rs @@ -690,6 +690,10 @@ impl UserInfo { /// /// No-op. #[cfg(target_vendor = "apple")] + #[expect( + clippy::unnecessary_wraps, + reason = "unify with platforms that support `setgroups`" + )] const fn drop_sup_groups() -> Result<(), Errno> { Ok(()) } @@ -958,6 +962,7 @@ pub fn setgroups(groups: &[Gid]) -> Result<(), Errno> { /// # Examples /// /// ```no_run +// # #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "linux", target_os = "netbsd", target_os = "openbsd"))] /// assert!(priv_sep::drop_supplementary_groups().is_ok()); /// ``` #[cfg_attr( @@ -975,7 +980,8 @@ pub fn setgroups(groups: &[Gid]) -> Result<(), Errno> { target_os = "freebsd", target_os = "linux", target_os = "netbsd", - target_os = "openbsd" + target_os = "openbsd", + all(doc, target_vendor = "apple") ))] #[expect(unsafe_code, reason = "setgroups(2) takes a pointer")] #[inline]