source: packages/net/tcpdump/patches/004-fix_3g_iface.patch @ 22081

Last change on this file since 22081 was 22081, checked in by jow, 6 years ago

[packages] tcpdump: properly handle iface names with leading digits (#7572)

File size: 768 bytes
  • tcpdump.c

    a b extern int SIZE_BUF; 
    6666#include <stdlib.h> 
    6767#include <string.h> 
    6868#include <limits.h> 
     69#include <ctype.h> 
    6970#ifndef WIN32 
    7071#include <sys/wait.h> 
    7172#include <sys/resource.h> 
    main(int argc, char **argv) 
    501502#ifdef HAVE_PCAP_FINDALLDEVS 
    502503        pcap_if_t *devpointer; 
    503504        int devnum; 
     505        char *devp; 
    504506#endif 
    505507        int status; 
    506508#ifdef WIN32 
    main(int argc, char **argv) 
    639641                         * It can be useful on Windows, where more than 
    640642                         * one interface can have the same name. 
    641643                         */ 
    642                         if ((devnum = atoi(optarg)) != 0) { 
     644                        for (devp = optarg; *devp && isdigit(*devp); devp++); 
     645                        if ((!*devp || isspace(*devp)) && (devnum = atoi(optarg)) != 0) { 
    643646                                if (devnum < 0) 
    644647                                        error("Invalid adapter index"); 
    645648 
Note: See TracBrowser for help on using the repository browser.