diff options
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/tail.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/toys/posix/tail.c b/toys/posix/tail.c index e1048be7..aba53180 100644 --- a/toys/posix/tail.c +++ b/toys/posix/tail.c @@ -176,9 +176,13 @@ static void do_tail(int fd, char *name) linepop = try[count] == '\n'; if (lines > 0) { + char c; + do { + c = *list->data; if (!--(list->len)) free(dlist_pop(&list)); - } while (*(list->data++) != '\n'); + else list->data++; + } while (c != '\n'); lines--; } } |