]> The Tcpdump Group git mirrors - libpcap/blobdiff - savefile.c
Fix pcap_offline_read() loop.
[libpcap] / savefile.c
index a35dffb5475fb3e5a2c2eb847e11e3bbb4b3301b..9e6a7deb6f891fece9ec955709efa3c1489ae92e 100644 (file)
@@ -618,12 +618,12 @@ int
 pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
 {
        struct bpf_insn *fcode;
-       int status = 0;
        int n = 0;
        u_char *data;
 
-       while (status == 0) {
+       for (;;) {
                struct pcap_pkthdr h;
+               int status;
 
                /*
                 * Has "pcap_breakloop()" been called?
@@ -651,12 +651,9 @@ pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
                }
                if (status == 0) {
                        /*
-                        * EOF.  Return the number of packets we've
-                        * processed in the loop; if we haven't
-                        * processed any, we return 0, which indicates
-                        * that we're at the end of the file.
+                        * EOF.  Nothing more to process;
                         */
-                       return (n);
+                       break;
                }
 
                /*