projects
/
musl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b3646b3
)
shadow: Implement fgetspent
author
Michael Forney
<mforney@mforney.org>
Thu, 21 Nov 2013 03:13:41 +0000
(19:13 -0800)
committer
Rich Felker
<dalias@aerifal.cx>
Mon, 25 Nov 2013 02:04:53 +0000
(21:04 -0500)
src/passwd/fgetspent.c
patch
|
blob
|
history
diff --git
a/src/passwd/fgetspent.c
b/src/passwd/fgetspent.c
index 3dda7848eb0347a1e2fb11fa7a0520e8ccac1654..47473bdb8cd84c0f31f57a89c11e654747589852 100644
(file)
--- a/
src/passwd/fgetspent.c
+++ b/
src/passwd/fgetspent.c
@@
-1,6
+1,15
@@
#include "pwf.h"
+#include <pthread.h>
struct spwd *fgetspent(FILE *f)
{
- return 0;
+ static char *line;
+ static struct spwd sp;
+ size_t size = 0;
+ struct spwd *res = 0;
+ int cs;
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
+ if (getline(&line, &size, f) >= 0 && __parsespent(line, &sp) >= 0) res = &sp;
+ pthread_setcancelstate(cs, 0);
+ return res;
}