File: gsgroups.c

package info (click to toggle)
super 3.30.0-3+squeeze2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,088 kB
  • ctags: 755
  • sloc: ansic: 10,089; sh: 288; makefile: 201
file content (38 lines) | stat: -rw-r--r-- 1,238 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
static const char rcsid[] = "$Id: gsgroups.c,v 1.8 2004/04/30 17:00:58 will Exp $";
/* This silly little file is here because gcc messes up badly with
 * prototyping the getgroups() / setgroups() functions on SunOS.
 * The problem is that on SunOS 4.x, there are two versions of each of
 * these functions: the usual (non-SysV) version takes an array of ints:
 * 	[gs]etgroups(int, int *)
 * but the Sys V version takes an array of gid_t's:
 * 	[gs]etgroups(int, gid_t *).
 * Unfortunately, gcc insists on the latter.  This isn't right for
 * most compilations -- it won't work unless you link with the
 * /usr/5lib version of libc.

 * Hence this little file: it invokes [gs]etgroups declaring its
 * argument as pointer to void, and _hope_ that this is the same
 * size pointer as (gid_t *), (uid_t *), and (int *).  If it is,
 * all will work smoothly on any host, yet we avoid including
 * the file <sys/unistd.h> wherein getgroups is inappropriately
 * prototyped.
 */
#include "config.h"

#ifdef HAVE_GETGROUPS
int Setgroups(n, g)
int n;
void *g;
{
    int setgroups P__((int, void *));
    return setgroups(n, g);
}
 
int Getgroups(n, g)
int n;
void *g;
{
    int getgroups P__((int, void *));
    return getgroups(n, g);
}
#endif