projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
drop use of pthread_once for aio thread stack size init
[musl]
/
src
/
passwd
/
getpwent_a.c
diff --git
a/src/passwd/getpwent_a.c
b/src/passwd/getpwent_a.c
index
34842a0
..
d1b4b53
100644
(file)
--- a/
src/passwd/getpwent_a.c
+++ b/
src/passwd/getpwent_a.c
@@
-8,14
+8,16
@@
static unsigned atou(char **s)
return x;
}
return x;
}
-
struct passwd *__getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size
)
+
int __getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size, struct passwd **res
)
{
ssize_t l;
char *s;
{
ssize_t l;
char *s;
+ int rv = 0;
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
for (;;) {
if ((l=getline(line, size, f)) < 0) {
int cs;
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);
for (;;) {
if ((l=getline(line, size, f)) < 0) {
+ rv = ferror(f) ? errno : 0;
free(*line);
*line = 0;
pw = 0;
free(*line);
*line = 0;
pw = 0;
@@
-46,5
+48,7
@@
struct passwd *__getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *siz
break;
}
pthread_setcancelstate(cs, 0);
break;
}
pthread_setcancelstate(cs, 0);
- return pw;
+ *res = pw;
+ if (rv) errno = rv;
+ return rv;
}
}