Skip to content

Commit 57246cf

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

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
@@ -1150,7 +1150,7 @@ pub fn setgroups(groups: &[Gid]) -> Result<()> {
11501150
/// and `setgroups()`. Additionally, while some implementations will return a
11511151
/// partial list of groups when `NGROUPS_MAX` is exceeded, this implementation
11521152
/// will only ever return the complete list or else an error.
1153-
pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
1153+
pub fn getgrouplist(user: &CStr, group: Gid) -> Result<Vec<Gid>> {
11541154
let ngroups_max = match sysconf(SysconfVar::NGROUPS_MAX) {
11551155
Ok(Some(n)) => n as c_int,
11561156
Ok(None) | Err(_) => <c_int>::max_value(),
@@ -1220,7 +1220,7 @@ pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
12201220
/// setgid(gid)?;
12211221
/// setuid(uid)?;
12221222
/// ```
1223-
pub fn initgroups(user: &CString, group: Gid) -> Result<()> {
1223+
pub fn initgroups(user: &CStr, group: Gid) -> Result<()> {
12241224
cfg_if! {
12251225
if #[cfg(any(target_os = "ios", target_os = "macos"))] {
12261226
type initgroups_group_t = c_int;

0 commit comments

Comments
 (0)