diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-09-12 21:36:42 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-09-12 21:36:42 -0700 |
commit | 167018511841f271ef8c3733d8c333d71d2baf65 (patch) | |
tree | 945cbb7157545aeff4ba98cdf9b5ca7ef1b356c4 /pcap-usb-linux.c | |
parent | a435a819af864928609c621055b6804d9fd16802 (diff) |
Use the read byte count when scanning through the results of the read.
Diffstat (limited to 'pcap-usb-linux.c')
-rw-r--r-- | pcap-usb-linux.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pcap-usb-linux.c b/pcap-usb-linux.c index 2ebd7037..49d67272 100644 --- a/pcap-usb-linux.c +++ b/pcap-usb-linux.c @@ -934,8 +934,8 @@ static int usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) { struct pcap_usb_linux *handlep = handle->priv; - int dummy, ret, consumed, cnt; - ssize_t read_ret; + int dummy, ret, cnt; + ssize_t read_ret, consumed; char string[USB_LINE_LEN]; char token[USB_LINE_LEN]; char * ptr = string; @@ -977,7 +977,7 @@ usb_stats_linux(pcap_t *handle, struct pcap_stat *stats) string[read_ret] = 0; /* extract info on dropped urbs */ - for (consumed=0; consumed < ret; ) { + for (consumed=0; consumed < read_ret; ) { /* from the sscanf man page: * The C standard says: "Execution of a %n directive does * not increment the assignment count returned at the completion |