dect
/
libpcap
Archived
13
0
Fork 0

Fix some problems pointed out by compiler warnings.

Include <arpa/inet.h> to declare htons().  Get rid of unused variables.
Fix an intended ioctl() call.
This commit is contained in:
Guy Harris 2009-12-31 15:10:02 -08:00
parent 03238ec05d
commit 1daef06321
1 changed files with 2 additions and 3 deletions

View File

@ -51,6 +51,7 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if.h> #include <net/if.h>
#include <arpa/inet.h>
#include <linux/can.h> #include <linux/can.h>
#include <linux/can/raw.h> #include <linux/can/raw.h>
@ -88,7 +89,6 @@ can_create(const char *device, char *ebuf)
static int static int
can_activate(pcap_t* handle) can_activate(pcap_t* handle)
{ {
int err = PCAP_ERROR;
struct sockaddr_can addr; struct sockaddr_can addr;
struct ifreq ifr; struct ifreq ifr;
@ -117,7 +117,7 @@ can_activate(pcap_t* handle)
/* get interface index */ /* get interface index */
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name)); strncpy(ifr.ifr_name, handle->opt.source, sizeof(ifr.ifr_name));
if ((handle->fd, SIOCGIFINDEX, &ifr) < 0) if (ioctl(handle->fd, SIOCGIFINDEX, &ifr) < 0)
{ {
snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"Unable to get interface index: %s", "Unable to get interface index: %s",
@ -166,7 +166,6 @@ can_read_linux(pcap_t *handle, int max_packets, pcap_handler callback, u_char *u
{ {
struct msghdr msg; struct msghdr msg;
struct pcap_pkthdr pkth; struct pcap_pkthdr pkth;
struct timeval tv;
struct iovec iv; struct iovec iv;
struct can_frame* cf; struct can_frame* cf;