title: libpcap error : truncated dump file; bogus savefile header
body: <p>I'm using a standard and simple program to read all packets for an open_file.
  open_file means that i'm using tcpdump in order to capture all traffic on the eth0 interface and write it all to a file.
  when running my program I get the following error code :</p>
  
  <pre><code>"truncated dump file; tried to read 16 header bytes, only got 11
  sleeping
  bogus savefile header
  sleeping
  bogus savefile header
  ..
  ..
  ..
  (and so on)"
  </code></pre>
  
  <p>this is the important part of the program :</p>
  
  <pre><code>handle = pcap_fopen_offline(pFile, errbuf);
  while (true) {
              if (pcap_loop(handle,num_packets , got_packet, NULL)== -1){
                      std::cout &lt;&lt; pcap_geterr(handle)&lt;&lt; std::endl;
              }
                      sleep(1);
                      std::cout &lt;&lt; "sleeping" &lt;&lt; std::endl;
  
          }
  
      pcap_close(handle);
  </code></pre>
  
  <p>so, i'm using sleep(1) in order to let the data to keep flowing before iterating again.</p>
  
  <p>is anybody has a clue why do I get this error?
  It looks like I happens when my program gets to the end of the file and start reading packet that the tcpdump did't finish writing. 
  After this error pcap_loop can't read any other packets from the open file.</p>