aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-12-14 20:00:01 -0600
committerRob Landley <rob@landley.net>2019-12-14 20:00:01 -0600
commit8bf47fcdf2da7f7a9b896676c119429bc7d0b4ff (patch)
treec1a078f4423483f5d9dc562fed2fab5c28b7eedf /lib
parent08b5330e2bbdfe5b79e7571c3bf242c7befe96bd (diff)
downloadtoybox-8bf47fcdf2da7f7a9b896676c119429bc7d0b4ff.tar.gz
Bugfix: xgetline() wasn't returning NULL at EOF.
Diffstat (limited to 'lib')
-rw-r--r--lib/xwrap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/xwrap.c b/lib/xwrap.c
index cfd17219..2f47ac66 100644
--- a/lib/xwrap.c
+++ b/lib/xwrap.c
@@ -1066,13 +1066,14 @@ char *xgetline(FILE *fp, int *len)
{
char *new = 0;
size_t linelen = 0;
+ long ll;
errno = 0;
- if (1>(linelen = getline(&new, &linelen, fp))) {
+ if (1>(ll = getline(&new, &linelen, fp))) {
if (errno) perror_msg("getline");
new = 0;
} else if (new[linelen-1] == '\n') new[--linelen] = 0;
- if (len) *len = linelen;
+ if (len) *len = ll;
return new;
}