summaryrefslogtreecommitdiff
path: root/pcap-usb-linux.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-09-12 19:41:38 -0700
committerGuy Harris <guy@alum.mit.edu>2018-09-12 20:18:59 -0700
commit10d7a3c17283fb3f97753a3f291468af774e871f (patch)
treeb3f58cc7a6f66e250149dc47f2afb8366d403c9d /pcap-usb-linux.c
parent5a3f2a9ec54a06ac925cf7f394038ac1212d9e56 (diff)
downloadlibpcap-10d7a3c17283fb3f97753a3f291468af774e871f.tar.gz
Squelch more narrowing warnings.
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r--pcap-usb-linux.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c
index 3412f243..4debcedc 100644
--- a/pcap-usb-linux.c
+++ b/pcap-usb-linux.c
@@ -136,7 +136,7 @@ static int usb_stats_linux_bin(pcap_t *, struct pcap_stat *);
static int usb_read_linux(pcap_t *, int , pcap_handler , u_char *);
static int usb_read_linux_bin(pcap_t *, int , pcap_handler , u_char *);
static int usb_read_linux_mmap(pcap_t *, int , pcap_handler , u_char *);
-static int usb_inject_linux(pcap_t *, const void *, size_t);
+static int usb_inject_linux(pcap_t *, const void *, int);
static int usb_setdirection_linux(pcap_t *, pcap_direction_t);
static void usb_cleanup_linux_mmap(pcap_t *);
@@ -145,7 +145,7 @@ have_binary_usbmon(void)
{
struct utsname utsname;
char *version_component, *endp;
- int major, minor, subminor;
+ long major, minor, subminor;
if (uname(&utsname) == 0) {
/*
@@ -734,6 +734,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
struct pcap_usb_linux *handlep = handle->priv;
unsigned timestamp;
int tag, cnt, ep_num, dev_addr, dummy, ret, urb_len, data_len;
+ ssize_t read_ret;
char etype, pipeid1, pipeid2, status[16], urb_tag, line[USB_LINE_LEN];
char *string = line;
u_char * rawdata = handle->buffer;
@@ -744,14 +745,14 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
/* ignore interrupt system call errors */
do {
- ret = read(handle->fd, line, USB_LINE_LEN - 1);
+ read_ret = read(handle->fd, line, USB_LINE_LEN - 1);
if (handle->break_loop)
{
handle->break_loop = 0;
return -2;
}
- } while ((ret == -1) && (errno == EINTR));
- if (ret < 0)
+ } while ((read_ret == -1) && (errno == EINTR));
+ if (read_ret < 0)
{
if (errno == EAGAIN)
return 0; /* no data there */
@@ -763,7 +764,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
/* read urb header; %n argument may increment return value, but it's
* not mandatory, so does not count on it*/
- string[ret] = 0;
+ string[read_ret] = 0;
ret = sscanf(string, "%x %d %c %c%c:%d:%d %s%n", &tag, &timestamp, &etype,
&pipeid1, &pipeid2, &dev_addr, &ep_num, status,
&cnt);
@@ -788,7 +789,7 @@ usb_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_cha
return -1;
}
uhdr->ts_sec = pkth.ts.tv_sec;
- uhdr->ts_usec = pkth.ts.tv_usec;
+ uhdr->ts_usec = (int32_t)pkth.ts.tv_usec;
/* parse endpoint information */
if (pipeid1 == 'C')
@@ -922,7 +923,7 @@ got:
}
static int
-usb_inject_linux(pcap_t *handle, const void *buf _U_, size_t size _U_)
+usb_inject_linux(pcap_t *handle, const void *buf _U_, int size _U_)
{
pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE, "inject not supported on "
"USB devices");
@@ -962,17 +963,17 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats)
/* read stats line */
do {
- ret = read(fd, string, USB_LINE_LEN-1);
- } while ((ret == -1) && (errno == EINTR));
+ read_ret = read(fd, string, USB_LINE_LEN-1);
+ } while ((read_ret == -1) && (errno == EINTR));
close(fd);
- if (ret < 0)
+ if (read_ret < 0)
{
pcap_snprintf(handle->errbuf, PCAP_ERRBUF_SIZE,
"Can't read stats from fd %d ", fd);
return -1;
}
- string[ret] = 0;
+ string[read_ret] = 0;
/* extract info on dropped urbs */
for (consumed=0; consumed < ret; ) {