diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-04-16 20:15:14 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-04-16 20:15:14 +0200 |
commit | 0288b27ad870adc437c370c262b7b41990ae0118 (patch) | |
tree | faa0c0dd84073b77b233d933c8cd39aa1d60ccc3 /libbb | |
parent | 89b3cbaa97d715ac27e9558ea73a1221925f589b (diff) |
small fixes atop syslog config patch
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-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 idx -= 2; } } - if (end) + if (end) { *end = idx; + /* handle corner case when the file is not ended with '\n' */ + if (ch == EOF && lineno != NULL) + (*lineno)++; + } if (linebuf) { // huh, does fgets discard prior data on error like this? // I don't think so.... |