diff options
Diffstat (limited to 'util-linux/script.c')
-rw-r--r-- | util-linux/script.c | 10 |
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) | |||
109 | 109 | ||
110 | if (child_pid) { | 110 | if (child_pid) { |
111 | /* parent */ | 111 | /* parent */ |
112 | #define buf bb_common_bufsiz1 | ||
113 | #define sizeof_buf COMMON_BUFSIZE | ||
114 | struct pollfd pfd[2]; | 112 | struct pollfd pfd[2]; |
115 | int outfd, count, loop; | 113 | int outfd, count, loop; |
116 | double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0; | 114 | double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0; |
117 | smallint fd_count = 2; | 115 | smallint fd_count = 2; |
116 | #define buf bb_common_bufsiz1 | ||
117 | setup_common_bufsiz(); | ||
118 | 118 | ||
119 | outfd = xopen(fname, mode); | 119 | outfd = xopen(fname, mode); |
120 | pfd[0].fd = pty; | 120 | pfd[0].fd = pty; |
@@ -136,7 +136,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
136 | } | 136 | } |
137 | if (pfd[0].revents) { | 137 | if (pfd[0].revents) { |
138 | errno = 0; | 138 | errno = 0; |
139 | count = safe_read(pty, buf, sizeof_buf); | 139 | count = safe_read(pty, buf, COMMON_BUFSIZE); |
140 | if (count <= 0 && errno != EAGAIN) { | 140 | if (count <= 0 && errno != EAGAIN) { |
141 | /* err/eof from pty: exit */ | 141 | /* err/eof from pty: exit */ |
142 | goto restore; | 142 | goto restore; |
@@ -159,7 +159,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
159 | } | 159 | } |
160 | } | 160 | } |
161 | if (pfd[1].revents) { | 161 | if (pfd[1].revents) { |
162 | count = safe_read(STDIN_FILENO, buf, sizeof_buf); | 162 | count = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE); |
163 | if (count <= 0) { | 163 | if (count <= 0) { |
164 | /* err/eof from stdin: don't read stdin anymore */ | 164 | /* err/eof from stdin: don't read stdin anymore */ |
165 | pfd[1].revents = 0; | 165 | pfd[1].revents = 0; |
@@ -178,7 +178,7 @@ int script_main(int argc UNUSED_PARAM, char **argv) | |||
178 | * (util-linux's script doesn't do this. buggy :) */ | 178 | * (util-linux's script doesn't do this. buggy :) */ |
179 | loop = 999; | 179 | loop = 999; |
180 | /* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */ | 180 | /* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */ |
181 | while (--loop && (count = safe_read(pty, buf, sizeof_buf)) > 0) { | 181 | while (--loop && (count = safe_read(pty, buf, COMMON_BUFSIZE)) > 0) { |
182 | full_write(STDOUT_FILENO, buf, count); | 182 | full_write(STDOUT_FILENO, buf, count); |
183 | full_write(outfd, buf, count); | 183 | full_write(outfd, buf, count); |
184 | } | 184 | } |