Initialize the supplementary group access list
#include <grp.h> #include <sys/types.h> int initgroups( const char * name, gid_t basegid );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The initgroups() function reads the group membership for the user specified by name from the group database, and then initializes the supplementary group access list of the calling process (see getgrnam() and getgroups()).
If the number of groups in the supplementary access list exceeds NGROUPS_MAX, the extra groups are ignored.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | No |
If initgroups() fails, it doesn't change the supplementary group access list.
The getgrouplist() function called by initgroups() is based on getgrent(). If the calling process uses getgrent(), the in-memory group structure is overwritten in the call to initgroups().