File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -943,6 +943,12 @@ pub fn setgid(gid: Gid) -> Result<()> {
943
943
944
944
/// Get the list of supplementary group IDs of the calling process.
945
945
///
946
+ /// *Note:* On macOS, `getgroups()` behavior differs somewhat from other Unix
947
+ /// platforms. It returns the current group access list for the user associated
948
+ /// with the effective user id of the process; the group access list may change
949
+ /// over the lifetime of the process, and it is not affected by calls to
950
+ /// `setgroups()`.
951
+ ///
946
952
/// [Further reading](http://pubs.opengroup.org/onlinepubs/009695399/functions/getgroups.html)
947
953
pub fn getgroups ( ) -> Result < Vec < Gid > > {
948
954
// First get the number of groups so we can size our Vec
@@ -978,6 +984,9 @@ pub fn getgroups() -> Result<Vec<Gid>> {
978
984
979
985
/// Set the list of supplementary group IDs for the calling process.
980
986
///
987
+ /// *Note:* On macOS, `getgroups()` may not return the same group list set by
988
+ /// calling `setgroups()`. Apple discourages the use of `setgroups()`.
989
+ ///
981
990
/// [Further reading](http://man7.org/linux/man-pages/man2/getgroups.2.html)
982
991
pub fn setgroups ( groups : & [ Gid ] ) -> Result < ( ) > {
983
992
cfg_if ! {
Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ mod linux_android {
105
105
}
106
106
107
107
#[ test]
108
+ #[ cfg( not( any( target_os = "ios" , target_os = "macos" ) ) ) ]
108
109
fn test_setgroups ( ) {
109
110
if !Uid :: current ( ) . is_root ( ) {
110
111
// setgroups() requires root
You can’t perform that action at this time.
0 commit comments