Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2677.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Cast the 'cap' argument of 'getgrnam_r' to 'i32' on AIX to match the signature in the AIX libc
16 changes: 15 additions & 1 deletion src/unistd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3940,7 +3940,21 @@ impl Group {
// at `grp`.
unsafe {
Group::from_anything(|grp, cbuf, cap, res| {
libc::getgrnam_r(name.as_ptr(), grp, cbuf, cap, res)
let converted_cap = {
// The AIX signature of 'getgrnam_r()' differs from the POSIX
// specification, which expects 'buf_size' to be of type
// 'size_t', whereas AIX uses'int'
#[cfg(target_os = "aix")]
{
cap as i32
}
#[cfg(not(target_os = "aix"))]
{
cap
}
};

libc::getgrnam_r(name.as_ptr(), grp, cbuf, converted_cap, res)
})
}
}
Expand Down
Loading