mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-18 05:24:03 +02:00
29 lines
768 B
Diff
29 lines
768 B
Diff
|
--- a/tcpdump.c
|
||
|
+++ b/tcpdump.c
|
||
|
@@ -66,6 +66,7 @@ extern int SIZE_BUF;
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <limits.h>
|
||
|
+#include <ctype.h>
|
||
|
#ifndef WIN32
|
||
|
#include <sys/wait.h>
|
||
|
#include <sys/resource.h>
|
||
|
@@ -625,6 +626,7 @@ main(int argc, char **argv)
|
||
|
#ifdef HAVE_PCAP_FINDALLDEVS
|
||
|
pcap_if_t *devpointer;
|
||
|
int devnum;
|
||
|
+ char *devp;
|
||
|
#endif
|
||
|
int status;
|
||
|
#ifdef WIN32
|
||
|
@@ -775,7 +777,8 @@ main(int argc, char **argv)
|
||
|
* It can be useful on Windows, where more than
|
||
|
* one interface can have the same name.
|
||
|
*/
|
||
|
- if ((devnum = atoi(optarg)) != 0) {
|
||
|
+ for (devp = optarg; *devp && isdigit(*devp); devp++);
|
||
|
+ if ((!*devp || isspace(*devp)) && (devnum = atoi(optarg)) != 0) {
|
||
|
if (devnum < 0)
|
||
|
error("Invalid adapter index");
|
||
|
|