]> granicus.if.org Git - php/commitdiff
- Fix trailling newline handling
authorFelipe Pena <felipensp@gmail.com>
Sun, 17 Nov 2013 12:23:50 +0000 (10:23 -0200)
committerFelipe Pena <felipensp@gmail.com>
Sun, 17 Nov 2013 12:23:50 +0000 (10:23 -0200)
phpdbg_list.c

index 0c61bc4a31930971f8318d12e5cb45675d70d06a..35de246ad0485d5a0f5adca4b284539a392c90d0 100644 (file)
@@ -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;