diff options
author | fenner <fenner@FreeBSD.org> | 2001-04-03 04:18:09 +0000 |
---|---|---|
committer | fenner <fenner@FreeBSD.org> | 2001-04-03 04:18:09 +0000 |
commit | a6bce8883c0f9dd7fee0eb03667f57b40b1d9dab (patch) | |
tree | 3549230334d9c115b8db8b950fb89d69f7b23d16 /contrib/libpcap/pcap-null.c | |
parent | 6f08532b51656817ca97987b95e3b7422d6be2ae (diff) | |
download | FreeBSD-src-a6bce8883c0f9dd7fee0eb03667f57b40b1d9dab.zip FreeBSD-src-a6bce8883c0f9dd7fee0eb03667f57b40b1d9dab.tar.gz |
Virgin import of tcpdump.org libpcap v0.6.2
Diffstat (limited to 'contrib/libpcap/pcap-null.c')
-rw-r--r-- | contrib/libpcap/pcap-null.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/contrib/libpcap/pcap-null.c b/contrib/libpcap/pcap-null.c index c0146bb..a4116ad 100644 --- a/contrib/libpcap/pcap-null.c +++ b/contrib/libpcap/pcap-null.c @@ -20,14 +20,17 @@ */ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-null.c,v 1.7.1.1 1999/10/07 23:46:40 mcr Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-null.c,v 1.13 2000/10/28 00:01:29 guy Exp $ (LBL)"; +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" #endif #include <sys/param.h> /* optionally get BSD define */ #include <string.h> -#include "gnuc.h" #ifdef HAVE_OS_PROTO_H #include "os-proto.h" #endif @@ -39,35 +42,33 @@ static char nosup[] = "live packet capture not supported on this system"; int pcap_stats(pcap_t *p, struct pcap_stat *ps) { - - (void)sprintf(p->errbuf, "pcap_stats: %s", nosup); + (void)snprintf(p->errbuf, sizeof(p->errbuf), "pcap_stats: %s", nosup); return (-1); } int pcap_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { - - (void)sprintf(p->errbuf, "pcap_read: %s", nosup); + (void)snprintf(p->errbuf, sizeof(p->errbuf), "pcap_read: %s", nosup); return (-1); } pcap_t * pcap_open_live(char *device, int snaplen, int promisc, int to_ms, char *ebuf) { - - (void)strcpy(ebuf, nosup); + (void)strlcpy(ebuf, nosup, PCAP_ERRBUF_SIZE); return (NULL); } int pcap_setfilter(pcap_t *p, struct bpf_program *fp) { - if (p->sf.rfile == NULL) { - (void)sprintf(p->errbuf, "pcap_setfilter: %s", nosup); + (void)snprintf(p->errbuf, sizeof(p->errbuf), + "pcap_setfilter: %s", nosup); return (-1); } - p->fcode = *fp; + if (install_bpf_program(p, fp) < 0) + return (-1); return (0); } |