release
[hcoop/zz_old/debian/djbdns.git] / prot.c
1 #include "hasshsgr.h"
2 #include "prot.h"
3
4 int prot_gid(int gid)
5 {
6 #ifdef HASSHORTSETGROUPS
7 short x[2];
8 x[0] = gid; x[1] = 73; /* catch errors */
9 if (setgroups(1,x) == -1) return -1;
10 #else
11 if (setgroups(1,&gid) == -1) return -1;
12 #endif
13 return setgid(gid); /* _should_ be redundant, but on some systems it isn't */
14 }
15
16 int prot_uid(int uid)
17 {
18 return setuid(uid);
19 }