Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/networking/nc.c


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/networking/nc.c

    r3232 r3621  
    99
    1010#include "libbb.h"
     11#include "common_bufsiz.h"
    1112
    1213//config:config NC
     
    2526//config:
    2627//config:config NC_EXTRA
    27 //config:   bool "Netcat extensions (-eiw and filename)"
     28//config:   bool "Netcat extensions (-eiw and -f FILE)"
    2829//config:   default y
    2930//config:   depends on NC
     
    4142//config:     The code is about 2.5k bigger. It enables
    4243//config:     -s ADDR, -n, -u, -v, -o FILE, -z options, but loses
    43 //config:     busybox-specific extensions: -f FILE and -ll.
     44//config:     busybox-specific extensions: -f FILE.
    4445
    4546#if ENABLE_NC_110_COMPAT
     
    6162//usage:       "Open a pipe to IP:PORT" IF_NC_EXTRA(" or FILE")
    6263//usage:    NC_OPTIONS_STR
    63 //usage:    IF_NC_EXTRA(
    64 //usage:     "\n    -e PROG Run PROG after connect"
    6564//usage:    IF_NC_SERVER(
    6665//usage:     "\n    -l  Listen mode, for inbound connects"
    6766//usage:    IF_NC_EXTRA(
    68 //usage:     "\n        (use -l twice with -e for persistent server)")
     67//usage:     "\n        (use -ll with -e for persistent server)"
     68//usage:    )
    6969//usage:     "\n    -p PORT Local port"
    7070//usage:    )
    71 //usage:     "\n    -w SEC  Timeout for connect"
     71//usage:    IF_NC_EXTRA(
     72//usage:     "\n    -w SEC  Connect timeout"
    7273//usage:     "\n    -i SEC  Delay interval for lines sent"
    7374//usage:     "\n    -f FILE Use file (ala /dev/ttyS0) instead of network"
     75//usage:     "\n    -e PROG Run PROG after connect"
    7476//usage:    )
    7577//usage:
     
    148150                    }
    149151                )
    150                 /* optind points to argv[arvc] (NULL) now.
     152                /* optind points to argv[argc] (NULL) now.
    151153                ** FIXME: we assume that getopt will not count options
    152154                ** possibly present on "-e PROG ARGS" and will not
     
    227229        xmove_fd(cfd, 0);
    228230        xdup2(0, 1);
    229         xdup2(0, 2);
     231        /*xdup2(0, 2); - original nc 1.10 does this, we don't */
    230232        IF_NC_EXTRA(BB_EXECVP(execparam[0], execparam);)
    231         /* Don't print stuff or it will go over the wire... */
    232         _exit(127);
     233        IF_NC_EXTRA(bb_perror_msg_and_die("can't execute '%s'", execparam[0]);)
    233234    }
    234235
     
    239240    FD_SET(STDIN_FILENO, &readfds);
    240241
     242#define iobuf bb_common_bufsiz1
     243    setup_common_bufsiz();
    241244    for (;;) {
    242245        int fd;
     
    249252            bb_perror_msg_and_die("select");
    250253
    251 #define iobuf bb_common_bufsiz1
    252254        fd = STDIN_FILENO;
    253255        while (1) {
    254256            if (FD_ISSET(fd, &testfds)) {
    255                 nread = safe_read(fd, iobuf, sizeof(iobuf));
     257                nread = safe_read(fd, iobuf, COMMON_BUFSIZE);
    256258                if (fd == cfd) {
    257259                    if (nread < 1)
     
    262264                        /* Close outgoing half-connection so they get EOF,
    263265                         * but leave incoming alone so we can see response */
    264                         shutdown(cfd, 1);
     266                        shutdown(cfd, SHUT_WR);
    265267                        FD_CLR(STDIN_FILENO, &readfds);
    266268                    }
Note: See TracChangeset for help on using the changeset viewer.