]> The Tcpdump Group git mirrors - libpcap/commitdiff
Fix some problems pointed out by compiler warnings.
authorGuy Harris <[email protected]>
Thu, 31 Dec 2009 23:10:02 +0000 (15:10 -0800)
committerGuy Harris <[email protected]>
Thu, 31 Dec 2009 23:10:02 +0000 (15:10 -0800)
Include <arpa/inet.h> to declare htons().  Get rid of unused variables.
Fix an intended ioctl() call.

pcap-can-linux.c

index 8210663ee4b41f98491997f487f184783e882d18..fb8e232c8973677d8a057713e596e7b3a3a5a885 100644 (file)
@@ -51,6 +51,7 @@
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <net/if.h>
+#include <arpa/inet.h>
 
 #include <linux/can.h>
 #include <linux/can/raw.h>
@@ -88,7 +89,6 @@ can_create(const char *device, char *ebuf)
 static int
 can_activate(pcap_t* handle)
 {
-       int err = PCAP_ERROR;
        struct sockaddr_can addr;
        struct ifreq ifr;
 
@@ -117,7 +117,7 @@ can_activate(pcap_t* handle)
        /* get interface index */
        memset(&ifr, 0, sizeof(ifr));
        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,
                                "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 pcap_pkthdr pkth;
-       struct timeval tv;
        struct iovec iv;
        struct can_frame* cf;