44 lines
1.1 KiB
Diff
44 lines
1.1 KiB
Diff
From 5b32ed79ccc1c9bb9a5bd815c28c4a4730cd1cc5 Mon Sep 17 00:00:00 2001
|
|
From: Roy Marples <roy@marples.name>
|
|
Date: Mon, 7 Oct 2019 15:07:25 +0100
|
|
Subject: [PATCH 2/2] Linux: File compile warnings
|
|
|
|
---
|
|
lpf.c | 7 ++++---
|
|
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/lpf.c b/lpf.c
|
|
index 36cbd1c..cfd517b 100644
|
|
--- a/lpf.c
|
|
+++ b/lpf.c
|
|
@@ -27,6 +27,7 @@
|
|
#include <sys/types.h>
|
|
#include <sys/ioctl.h>
|
|
#include <sys/socket.h>
|
|
+#include <sys/uio.h>
|
|
|
|
#include <arpa/inet.h>
|
|
#include <net/if.h>
|
|
@@ -91,7 +92,7 @@ bpf_open_arp(struct interface *ifp)
|
|
memset(&su, 0, sizeof(su));
|
|
su.sll.sll_family = PF_PACKET;
|
|
su.sll.sll_protocol = htons(ETH_P_ALL);
|
|
- su.sll.sll_ifindex = if_nametoindex(ifp->ifname);
|
|
+ su.sll.sll_ifindex = (int)if_nametoindex(ifp->ifname);
|
|
if (bind(s, &su.sa, sizeof(su.sll)) == -1)
|
|
goto eexit;
|
|
|
|
@@ -140,7 +141,7 @@ bpf_read(struct interface *ifp, void *data, size_t len)
|
|
}
|
|
bytes -= ETHER_HDR_LEN;
|
|
if ((size_t)bytes > len)
|
|
- bytes = len;
|
|
- memcpy(data, ifp->buffer + ETHER_HDR_LEN, bytes);
|
|
+ bytes = (ssize_t)len;
|
|
+ memcpy(data, ifp->buffer + ETHER_HDR_LEN, (size_t)bytes);
|
|
return bytes;
|
|
}
|
|
--
|
|
2.32.0
|
|
|