X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/371e1fca312ecc698f01dfa16f81c48cb48f7c55..40f1cf8aa72185cce0994aaaf8b14d524e5a4d8b:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index c4b2c9c4..ba154278 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -92,6 +92,19 @@ The Regents of the University of California. All rights reserved.\n"; #endif /* HAVE_CASPER */ #endif /* HAVE_CAPSICUM */ #ifdef HAVE_PCAP_OPEN +/* + * We found pcap_open() in the capture library, so we'll be using + * the remote capture APIs; define PCAP_REMOTE before we include pcap.h, + * so we get those APIs declared, and the types and #defines that they + * use defined. + * + * WinPcap's headers require that PCAP_REMOTE be defined in order to get + * remote-capture APIs declared and types and #defines that they use + * defined. + * + * (Versions of libpcap with those APIs, and thus Npcap, which is based on + * those versions of libpcap, don't require it.) + */ #define HAVE_REMOTE #endif #include @@ -1028,7 +1041,8 @@ copy_argv(char **argv) static char * read_infile(char *fname) { - int i, fd, cc; + int i, fd; + ssize_t cc; char *cp; struct stat buf; @@ -1047,7 +1061,7 @@ read_infile(char *fname) if (cc < 0) error("read %s: %s", fname, pcap_strerror(errno)); if (cc != buf.st_size) - error("short read %s (%d != %d)", fname, cc, (int)buf.st_size); + error("short read %s (%zd != %d)", fname, cc, (int)buf.st_size); close(fd); /* replace "# comment" with spaces */ @@ -1433,7 +1447,7 @@ main(int argc, char **argv) char ebuf[PCAP_ERRBUF_SIZE]; char VFileLine[PATH_MAX + 1]; char *username = NULL; - char *chroot_dir = NULL; + const char *chroot_dir = NULL; char *ret = NULL; char *end; #ifdef HAVE_PCAP_FINDALLDEVS @@ -1714,7 +1728,7 @@ main(int argc, char **argv) break; case 's': - ndo->ndo_snaplen = strtol(optarg, &end, 0); + ndo->ndo_snaplen = (int)strtol(optarg, &end, 0); if (optarg == end || *end != '\0' || ndo->ndo_snaplen < 0 || ndo->ndo_snaplen > MAXIMUM_SNAPLEN) error("invalid snaplen %s (must be >= 0 and <= %d)",