gid.c (410B)
1 #include <sys/types.h> 2 #include <grp.h> 3 #include <unistd.h> 4 #include "uidgid.h" 5 #include "subfd.h" 6 #include "substdio.h" 7 8 gid_t 9 initgid(char *group) 10 { 11 struct group *gr; 12 gr = getgrnam(group); 13 if (!gr) { 14 substdio_puts(subfderr,"fatal: unable to find group "); 15 substdio_puts(subfderr,group); 16 substdio_puts(subfderr,"\n"); 17 substdio_flush(subfderr); 18 _exit(111); 19 } 20 return gr->gr_gid; 21 }