From 9de2e5a22213842da5b116723392de88de9ed419 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 21 Apr 2016 18:38:51 +0200 Subject: *: hopefully all setup_common_bufsiz() are in place Signed-off-by: Denys Vlasenko --- util-linux/script.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'util-linux/script.c') diff --git a/util-linux/script.c b/util-linux/script.c index 6195161bc..86475c1f1 100644 --- a/util-linux/script.c +++ b/util-linux/script.c @@ -109,12 +109,12 @@ int script_main(int argc UNUSED_PARAM, char **argv) if (child_pid) { /* parent */ -#define buf bb_common_bufsiz1 -#define sizeof_buf COMMON_BUFSIZE struct pollfd pfd[2]; int outfd, count, loop; double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0; smallint fd_count = 2; +#define buf bb_common_bufsiz1 + setup_common_bufsiz(); outfd = xopen(fname, mode); pfd[0].fd = pty; @@ -136,7 +136,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) } if (pfd[0].revents) { errno = 0; - count = safe_read(pty, buf, sizeof_buf); + count = safe_read(pty, buf, COMMON_BUFSIZE); if (count <= 0 && errno != EAGAIN) { /* err/eof from pty: exit */ goto restore; @@ -159,7 +159,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) } } if (pfd[1].revents) { - count = safe_read(STDIN_FILENO, buf, sizeof_buf); + count = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE); if (count <= 0) { /* err/eof from stdin: don't read stdin anymore */ pfd[1].revents = 0; @@ -178,7 +178,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) * (util-linux's script doesn't do this. buggy :) */ loop = 999; /* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */ - while (--loop && (count = safe_read(pty, buf, sizeof_buf)) > 0) { + while (--loop && (count = safe_read(pty, buf, COMMON_BUFSIZE)) > 0) { full_write(STDOUT_FILENO, buf, count); full_write(outfd, buf, count); } -- cgit v1.2.3