*: hopefully all setup_common_bufsiz() are in place
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ int umount_main(int argc UNUSED_PARAM, char **argv)
|
||||
if (opt & OPT_ALL)
|
||||
bb_error_msg_and_die("can't open '%s'", bb_path_mtab_file);
|
||||
} else {
|
||||
setup_common_bufsiz();
|
||||
while (getmntent_r(fp, &me, bb_common_bufsiz1, COMMON_BUFSIZE)) {
|
||||
/* Match fstype if passed */
|
||||
if (!match_fstype(&me, fstype))
|
||||
|
||||
Reference in New Issue
Block a user