Fix compilation errors caused by more files not added in previous commit

This commit is contained in:
Thomas Veerman
2009-12-20 21:31:03 +00:00
parent 951c5f6b73
commit bcecad33d5
3 changed files with 396 additions and 0 deletions

34
lib/other/initgroups.c Normal file
View File

@@ -0,0 +1,34 @@
/*
initgroups.c
*/
#include <sys/param.h>
#include <unistd.h>
#include <string.h>
#include <grp.h>
int initgroups(const char *name, gid_t basegid)
{
struct group *gr;
int r, found = 0, n = 0;
gid_t groups[NGROUPS];
if((r = setgid(basegid)) < 0)
return(r);
setgrent();
while ((gr = getgrent()) != NULL && (n + 1) <= NGROUPS) {
char **mem;
for(mem = gr->gr_mem; mem && *mem; mem++) {
if(!strcmp(name, *mem)) {
groups[n++] = gr->gr_gid;
break;
}
}
}
endgrent();
return setgroups(n, groups);
}

7
lib/syscall/setgroups.s Normal file
View File

@@ -0,0 +1,7 @@
.sect .text
.extern __setgroups
.define _setgroups
.align 2
_setgroups:
jmp __setgroups