From 180bb579bfcae9e6a42c1c738ea66bdbb6463d19 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 17 Nov 2013 10:23:50 -0200 Subject: [PATCH] - Fix trailling newline handling --- phpdbg_list.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phpdbg_list.c b/phpdbg_list.c index 0c61bc4a31..35de246ad0 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -179,11 +179,15 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig end_pos = mem + st.st_size; #endif while (1) { + if (pos == end_pos) { + break; + } + pos = memchr(last_pos, '\n', end_pos - last_pos); if (!pos) { /* No more line breaks */ - break; + pos = end_pos; } ++line; -- 2.40.0