Skip to content

Commit 55ece25

Browse files
committed
unistd: Make getgrouplist and initgroups take &CStr
Don't need to call as_c_str()
1 parent b5cc435 commit 55ece25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/unistd.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ pub fn setgroups(groups: &[Gid]) -> Result<()> {
10851085
/// and `setgroups()`. Additionally, while some implementations will return a
10861086
/// partial list of groups when `NGROUPS_MAX` is exceeded, this implementation
10871087
/// will only ever return the complete list or else an error.
1088-
pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
1088+
pub fn getgrouplist(user: &CStr, group: Gid) -> Result<Vec<Gid>> {
10891089
let ngroups_max = match sysconf(SysconfVar::NGROUPS_MAX) {
10901090
Ok(Some(n)) => n as c_int,
10911091
Ok(None) | Err(_) => <c_int>::max_value(),
@@ -1155,7 +1155,7 @@ pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
11551155
/// setgid(gid)?;
11561156
/// setuid(uid)?;
11571157
/// ```
1158-
pub fn initgroups(user: &CString, group: Gid) -> Result<()> {
1158+
pub fn initgroups(user: &CStr, group: Gid) -> Result<()> {
11591159
cfg_if! {
11601160
if #[cfg(any(target_os = "ios", target_os = "macos"))] {
11611161
type initgroups_group_t = c_int;

0 commit comments

Comments
 (0)