Hello,
There's one instance in tail(1) where recallocarray is appropriate. In
fact, it would have prevented the regression I introduced originally.
OK?
martijn@
Index: read.c
===================================================================
RCS file: /cvs/src/usr.bin/tail/read.c,v
retrieving revision 1.18
diff -u -p -r1.18 read.c
--- read.c 1 Feb 2017 16:21:12 -0000 1.18
+++ read.c 26 Mar 2017 16:29:24 -0000
@@ -166,10 +166,9 @@ lines(struct tailfile *tf, off_t off)
if (recno >= lineno) {
nlineno = (lineno + 1024) > off ?
(size_t) off : lineno + 1024;
- lines = reallocarray(lines, nlineno, sizeof(*lines));
- if (lines == NULL)
+ if ((lines = recallocarray(lines, lineno, nlineno,
+ sizeof(*lines))) == NULL)
err(1, NULL);
- bzero(lines + recno, nlineno - lineno);
lineno = nlineno;
}
if (ch == '\n') {