=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/wc/wc.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- src/usr.bin/wc/wc.c 2021/11/16 23:34:24 1.28 +++ src/usr.bin/wc/wc.c 2021/11/28 19:28:42 1.29 @@ -1,4 +1,4 @@ -/* $OpenBSD: wc.c,v 1.28 2021/11/16 23:34:24 cheloha Exp $ */ +/* $OpenBSD: wc.c,v 1.29 2021/11/28 19:28:42 deraadt Exp $ */ /* * Copyright (c) 1980, 1987, 1991, 1993 @@ -29,7 +29,6 @@ * SUCH DAMAGE. */ -#include /* MAXBSIZE */ #include #include @@ -43,6 +42,8 @@ #include #include +#define _MAXBSIZE (64 * 1024) + int64_t tlinect, twordct, tcharct; int doline, doword, dochar, humanchar, multibyte; int rval; @@ -145,8 +146,8 @@ } if (!doword && !multibyte) { - if (bufsz < MAXBSIZE && - (buf = realloc(buf, MAXBSIZE)) == NULL) + if (bufsz < _MAXBSIZE && + (buf = realloc(buf, _MAXBSIZE)) == NULL) err(1, NULL); /* * Line counting is split out because it's a lot @@ -154,7 +155,7 @@ * the word count requires some logic. */ if (doline) { - while ((len = read(fd, buf, MAXBSIZE)) > 0) { + while ((len = read(fd, buf, _MAXBSIZE)) > 0) { charct += len; for (C = buf; len--; ++C) if (*C == '\n') @@ -184,7 +185,7 @@ || ifmt == S_IFDIR) { charct = sbuf.st_size; } else { - while ((len = read(fd, buf, MAXBSIZE)) > 0) + while ((len = read(fd, buf, _MAXBSIZE)) > 0) charct += len; if (len == -1) { warn("%s", file);