Changeset 1490 for trunk/lib/format_pcapfile.c
- Timestamp:
- 01/19/10 15:35:02 (3 years ago)
- File:
-
- 1 edited
-
trunk/lib/format_pcapfile.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/format_pcapfile.c
r1443 r1490 279 279 int err; 280 280 uint32_t flags = 0; 281 281 size_t bytes_to_read = 0; 282 282 283 assert(libtrace->format_data); 283 284 … … 303 304 return 0; 304 305 } 305 306 assert(swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen)<LIBTRACE_PACKET_BUFSIZE); 307 306 307 bytes_to_read = swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen); 308 309 assert(bytes_to_read < LIBTRACE_PACKET_BUFSIZE); 310 311 /* If there is no payload to read, do not ask wandio_read to try and 312 * read zero bytes - we'll just get back a zero that we will 313 * misinterpret as EOF! */ 314 if (bytes_to_read == 0) { 315 return sizeof(libtrace_pcapfile_pkt_hdr_t); 316 } 308 317 309 318 err=wandio_read(libtrace->io, … … 326 335 } 327 336 328 return sizeof(libtrace_pcapfile_pkt_hdr_t) 329 +swapl(libtrace,((libtrace_pcapfile_pkt_hdr_t*)packet->buffer)->caplen); 337 return sizeof(libtrace_pcapfile_pkt_hdr_t) + bytes_to_read; 330 338 } 331 339
Note: See TracChangeset
for help on using the changeset viewer.
