From: Denis Vlasenko Date: Fri, 5 Oct 2007 19:17:16 +0000 (-0000) Subject: tail: sizeof(buf) is sizeof(char*)! must be BUFSIZ X-Git-Tag: 1_8_0~93 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=226002ea74a5285bb338b17419c13f43a1ff5a47;p=oweals%2Fbusybox.git tail: sizeof(buf) is sizeof(char*)! must be BUFSIZ --- diff --git a/coreutils/tail.c b/coreutils/tail.c index 8a112346d..53dbf33ac 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c @@ -57,7 +57,7 @@ static ssize_t tail_read(int fd, char *buf, size_t count) if (sbuf.st_size < current) lseek(fd, 0, SEEK_SET); - r = safe_read(fd, buf, count); + r = full_read(fd, buf, count); if (r < 0) { bb_perror_msg(bb_msg_read_error); G.status = EXIT_FAILURE; @@ -271,7 +271,7 @@ int tail_main(int argc, char **argv) if (nfiles > header_threshhold) { fmt = header_fmt; } - while ((nread = tail_read(fds[i], buf, sizeof(buf))) > 0) { + while ((nread = tail_read(fds[i], buf, BUFSIZ)) > 0) { if (fmt) { tail_xprint_header(fmt, argv[i]); fmt = NULL;