char ebuf[PCAP_ERRBUF_SIZE];
char *username = NULL;
char *chroot_dir = NULL;
+ char *end;
#ifdef HAVE_PCAP_FINDALLDEVS
pcap_if_t *devpointer;
int devnum;
* It can be useful on Windows, where more than
* one interface can have the same name.
*/
- if ((devnum = atoi(optarg)) != 0) {
+ devnum = strtol(optarg, &end, 10);
+ if (optarg != end && *end == '\0') {
if (devnum < 0)
error("Invalid adapter index");
Rflag = 0;
break;
- case 's': {
- char *end;
-
+ case 's':
snaplen = strtol(optarg, &end, 0);
if (optarg == end || *end != '\0'
|| snaplen < 0 || snaplen > MAXIMUM_SNAPLEN)
else if (snaplen == 0)
snaplen = MAXIMUM_SNAPLEN;
break;
- }
case 'S':
++Sflag;