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/netstat.c

    r3232 r3621  
    120120/* When there are IPv6 connections the IPv6 addresses will be
    121121 * truncated to none-recognition. The '-W' option makes the
    122  * address columns wide enough to accomodate for longest possible
     122 * address columns wide enough to accommodate for longest possible
    123123 * IPv6 addresses, i.e. addresses of the form
    124124 * xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:ddd.ddd.ddd.ddd
     
    126126#define ADDR_WIDE                51  /* INET6_ADDRSTRLEN + 5 for the port number */
    127127#if ENABLE_FEATURE_NETSTAT_WIDE
    128 # define FMT_NET_CONN_DATA       "%s   %6ld %6ld %-*s %-*s %-12s"
     128# define FMT_NET_CONN_DATA       "%s   %6lu %6lu %-*s %-*s %-12s"
    129129# define FMT_NET_CONN_HEADER     "\nProto Recv-Q Send-Q %-*s %-*s State       %s\n"
    130130#else
    131 # define FMT_NET_CONN_DATA       "%s   %6ld %6ld %-23s %-23s %-12s"
     131# define FMT_NET_CONN_DATA       "%s   %6lu %6lu %-23s %-23s %-12s"
    132132# define FMT_NET_CONN_HEADER     "\nProto Recv-Q Send-Q %-23s %-23s State       %s\n"
    133133#endif
     
    229229    long inode = -1;
    230230
    231     if (strncmp(lname, "socket:[", sizeof("socket:[")-1) == 0) {
     231    if (is_prefixed_with(lname, "socket:[")) {
    232232        /* "socket:[12345]", extract the "12345" as inode */
    233233        inode = bb_strtoul(lname + sizeof("socket:[")-1, (char**)&lname, 0);
    234234        if (*lname != ']')
    235235            inode = -1;
    236     } else if (strncmp(lname, "[0000]:", sizeof("[0000]:")-1) == 0) {
     236    } else if (is_prefixed_with(lname, "[0000]:")) {
    237237        /* "[0000]:12345", extract the "12345" as inode */
    238238        inode = bb_strtoul(lname + sizeof("[0000]:")-1, NULL, 0);
     
    404404            "%32[0-9A-Fa-f]:%X %X "
    405405            "%lX:%lX %*X:%*X "
    406             "%*X %d %*d %ld ",
     406            "%*X %d %*d %lu ",
    407407            local_addr, &param->local_port,
    408408            rem_addr, &param->rem_port, &param->state,
     
    612612    strcat(ss_flags, "]");
    613613
    614     printf("%-5s %-6ld %-11s %-10s %-13s %6lu ",
     614    printf("%-5s %-6lu %-11s %-10s %-13s %6lu ",
    615615        ss_proto, refcnt, ss_flags, ss_type, ss_state, inode
    616616        );
     
    623623    /* TODO: currently we stop at first NUL byte. Is it a problem? */
    624624    line += path_ofs;
    625     *strchrnul(line, '\n') = '\0';
     625    chomp(line);
    626626    while (*line)
    627627        fputc_printable(*line++, stdout);
Note: See TracChangeset for help on using the changeset viewer.