On Wed, Feb 23, 2005 at 05:06:07PM +0100, Kjartan Maraas wrote:
Hi.
It looks like this function moved? The man page says:
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
but it seems like it's really living in <grp.h>:
[kmaraas@localhost xpl]$ grep setgroups /usr/include/*.h
/usr/include/grp.h:extern int setgroups (size_t __n, __const __gid_t
*__groups) __THROW;
What's the right way of getting at this function? Preferrably in a way
that works with other distros/OSes?
You haven't read the man page carefully:
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int getgroups(int size, gid_t list[]);
#include <grp.h>
int setgroups(size_t size, const gid_t *list);
I.e. for getgroups you need sys/types.h and unistd.h and for setgroups
also grp.h.
Jakub