diff options
author | Rich Felker <dalias@aerifal.cx> | 2015-02-23 00:42:40 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-02-23 00:42:40 -0500 |
commit | 0afef1aa24b784c86ae6121ca39e999824086c7c (patch) | |
tree | 306d47b63e5c57b451d3e73e5738ff8dc2c2eb42 | |
parent | fc5a96c9c8aa186effad7520d5df6b616bbfd29d (diff) | |
download | musl-0afef1aa24b784c86ae6121ca39e999824086c7c.tar.gz musl-0afef1aa24b784c86ae6121ca39e999824086c7c.tar.xz musl-0afef1aa24b784c86ae6121ca39e999824086c7c.zip |
fix spurious errors in refactored passwd/group code
errno was treated as the error status when the return value of getline was negative, but this condition can simply indicate EOF and is not necessarily an error. the spurious errors caused by this bug masked the bug which was fixed in commit fc5a96c9c8aa186effad7520d5df6b616bbfd29d.
-rw-r--r-- | src/passwd/getgrent_a.c | 2 | ||||
-rw-r--r-- | src/passwd/getpwent_a.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/passwd/getgrent_a.c b/src/passwd/getgrent_a.c index bafc9ed2..ecd2f2ea 100644 --- a/src/passwd/getgrent_a.c +++ b/src/passwd/getgrent_a.c @@ -18,7 +18,7 @@ int __getgrent_a(FILE *f, struct group *gr, char **line, size_t *size, char ***m pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); for (;;) { if ((l=getline(line, size, f)) < 0) { - rv = errno; + rv = ferror(f) ? errno : 0; free(*line); *line = 0; gr = 0; diff --git a/src/passwd/getpwent_a.c b/src/passwd/getpwent_a.c index 4d84f0d5..d1b4b53c 100644 --- a/src/passwd/getpwent_a.c +++ b/src/passwd/getpwent_a.c @@ -17,7 +17,7 @@ int __getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size, struct p pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs); for (;;) { if ((l=getline(line, size, f)) < 0) { - rv = errno; + rv = ferror(f) ? errno : 0; free(*line); *line = 0; pw = 0; |