projects
/
oweals
/
musl.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
add legacy sys/ttydefaults.h header
[oweals/musl.git]
/
src
/
passwd
/
putgrent.c
1
#include <grp.h>
2
#include <stdio.h>
3
4
int putgrent(const struct group *gr, FILE *f)
5
{
6
int r;
7
size_t i;
8
flockfile(f);
9
r = fprintf(f, "%s:%s:%d:", gr->gr_name, gr->gr_passwd, gr->gr_gid);
10
if (gr->gr_mem) for (i=0; gr->gr_mem[i]; i++)
11
if (fprintf(f, "%s%s", i?",":"", gr->gr_mem[i])<0) r = -1;
12
funlockfile(f);
13
return r<0 ? -1 : 0;
14
}