Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/util-linux/script.c

    r3232 r3621  
    2424
    2525#include "libbb.h"
     26#include "common_bufsiz.h"
    2627
    2728int script_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     
    7879        printf("Script started, file is %s\n", fname);
    7980    }
     81
    8082    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();
    8189
    8290    pty = xgetpty(pty_line);
     
    102110    if (child_pid) {
    103111        /* parent */
    104 #define buf bb_common_bufsiz1
    105112        struct pollfd pfd[2];
    106113        int outfd, count, loop;
    107114        double oldtime = ENABLE_SCRIPTREPLAY ? time(NULL) : 0;
    108115        smallint fd_count = 2;
     116#define buf bb_common_bufsiz1
     117        setup_common_bufsiz();
    109118
    110119        outfd = xopen(fname, mode);
     
    128137            if (pfd[0].revents) {
    129138                errno = 0;
    130                 count = safe_read(pty, buf, sizeof(buf));
     139                count = safe_read(pty, buf, COMMON_BUFSIZE);
    131140                if (count <= 0 && errno != EAGAIN) {
    132141                    /* err/eof from pty: exit */
     
    151160            }
    152161            if (pfd[1].revents) {
    153                 count = safe_read(STDIN_FILENO, buf, sizeof(buf));
     162                count = safe_read(STDIN_FILENO, buf, COMMON_BUFSIZE);
    154163                if (count <= 0) {
    155164                    /* err/eof from stdin: don't read stdin anymore */
     
    170179        loop = 999;
    171180        /* 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) {
    173182            full_write(STDOUT_FILENO, buf, count);
    174183            full_write(outfd, buf, count);
Note: See TracChangeset for help on using the changeset viewer.