aboutsummaryrefslogtreecommitdiff
path: root/util-linux/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/script.c')
-rw-r--r--util-linux/script.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/util-linux/script.c b/util-linux/script.c
index abcd73bff..6195161bc 100644
--- a/util-linux/script.c
+++ b/util-linux/script.c
@@ -23,6 +23,7 @@
//usage: )
#include "libbb.h"
+#include "common_bufsiz.h"
int script_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int script_main(int argc UNUSED_PARAM, char **argv)
@@ -108,7 +109,8 @@ int script_main(int argc UNUSED_PARAM, char **argv)
if (child_pid) {
/* parent */
-#define buf bb_common_bufsiz1
+#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;
@@ -134,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, sizeof_buf);
if (count <= 0 && errno != EAGAIN) {
/* err/eof from pty: exit */
goto restore;
@@ -157,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, sizeof_buf);
if (count <= 0) {
/* err/eof from stdin: don't read stdin anymore */
pfd[1].revents = 0;
@@ -176,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, sizeof_buf)) > 0) {
full_write(STDOUT_FILENO, buf, count);
full_write(outfd, buf, count);
}