Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/util-linux/script.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/util-linux/script.c
r3232 r3621 24 24 25 25 #include "libbb.h" 26 #include "common_bufsiz.h" 26 27 27 28 int script_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; … … 78 79 printf("Script started, file is %s\n", fname); 79 80 } 81 80 82 shell = get_shell_name(); 83 84 /* Some people run "script ... 0>&-". 85 * Our code assumes that STDIN_FILENO != pty. 86 * Ensure STDIN_FILENO is not closed: 87 */ 88 bb_sanitize_stdio(); 81 89 82 90 pty = xgetpty(pty_line); … … 102 110 if (child_pid) { 103 111 /* parent */ 104 #define buf bb_common_bufsiz1105 112 struct pollfd pfd[2]; 106 113 int outfd, count, loop; 107 114 double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0; 108 115 smallint fd_count = 2; 116 #define buf bb_common_bufsiz1 117 setup_common_bufsiz(); 109 118 110 119 outfd = xopen(fname, mode); … … 128 137 if (pfd[0].revents) { 129 138 errno = 0; 130 count = safe_read(pty, buf, sizeof(buf));139 count = safe_read(pty, buf, COMMON_BUFSIZE); 131 140 if (count <= 0 && errno != EAGAIN) { 132 141 /* err/eof from pty: exit */ … … 151 160 } 152 161 if (pfd[1].revents) { 153 count = safe_read(STDIN_FILENO, buf, sizeof(buf));162 count = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE); 154 163 if (count <= 0) { 155 164 /* err/eof from stdin: don't read stdin anymore */ … … 170 179 loop = 999; 171 180 /* pty is in O_NONBLOCK mode, we exit as soon as buffer is empty */ 172 while (--loop && (count = safe_read(pty, buf, sizeof(buf))) > 0) {181 while (--loop && (count = safe_read(pty, buf, COMMON_BUFSIZE)) > 0) { 173 182 full_write(STDOUT_FILENO, buf, count); 174 183 full_write(outfd, buf, count);
Note:
See TracChangeset
for help on using the changeset viewer.