From: Jim Meyering Date: Thu, 16 Feb 1995 00:10:49 +0000 (+0000) Subject: (wc): Fix off-by-one error when counting lines. X-Git-Tag: textutils-1_12_1~292 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=695dd1100332ca4589dfc7bef3b91035286a526b;p=thirdparty%2Fcoreutils.git (wc): Fix off-by-one error when counting lines. --- diff --git a/src/wc.c b/src/wc.c index 1f362fd095..fd75bcce7f 100644 --- a/src/wc.c +++ b/src/wc.c @@ -253,7 +253,7 @@ wc (fd, file) --p; do { - p = memchr (p + 1, '\n', bytes_read); + p = memchr (p + 1, '\n', bytes_read + 1); ++lines; } while (p != buf + bytes_read);