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.
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;
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;