diff options
Diffstat (limited to '')
-rw-r--r-- | libbb/get_line_from_file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c index a0ed9193f..9be10687b 100644 --- a/libbb/get_line_from_file.c +++ b/libbb/get_line_from_file.c | |||
@@ -44,8 +44,12 @@ char* FAST_FUNC bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno | |||
44 | idx -= 2; | 44 | idx -= 2; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | if (end) | 47 | if (end) { |
48 | *end = idx; | 48 | *end = idx; |
49 | /* handle corner case when the file is not ended with '\n' */ | ||
50 | if (ch == EOF && lineno != NULL) | ||
51 | (*lineno)++; | ||
52 | } | ||
49 | if (linebuf) { | 53 | if (linebuf) { |
50 | // huh, does fgets discard prior data on error like this? | 54 | // huh, does fgets discard prior data on error like this? |
51 | // I don't think so.... | 55 | // I don't think so.... |