aboutsummaryrefslogtreecommitdiff
path: root/util-linux/script.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-04-21 18:38:51 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-04-21 18:38:51 +0200
commit9de2e5a22213842da5b116723392de88de9ed419 (patch)
treedff999a566382174e084d377dc3b4c03de1d4c62 /util-linux/script.c
parent47cfbf32fd66563f8c4e09ad6cced6abfbe2fad5 (diff)
downloadbusybox-9de2e5a22213842da5b116723392de88de9ed419.tar.gz
*: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/script.c')
-rw-r--r--util-linux/script.c10
1 files changed, 5 insertions, 5 deletions
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);
}