- Timestamp:
- 04/23/06 14:11:01 (16 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 698a217
- Parents:
- e337363
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_wag.c
r222d8f5 r4315572b 298 298 buffer2 = buffer = packet->buffer; 299 299 300 301 if ((numbytes = libtrace_io_read(INPUT.file, buffer, sizeof(struct frame_t))) == -1) { 300 numbytes = libtrace_io_read(INPUT.file, buffer, sizeof(struct frame_t)); 301 302 if (numbytes == 0) { 303 return 0; 304 } 305 306 if (numbytes != sizeof(struct frame_t)) { 302 307 int err=errno; 303 308 trace_set_err(libtrace,err, … … 307 312 } 308 313 309 if (numbytes == 0) {310 return 0;311 }312 313 314 if (htons(((struct frame_t *)buffer)->magic) != 0xdaa1) { 314 315 trace_set_err(libtrace, 315 TRACE_ERR_BAD_PACKET,"Insufficient magic ");316 TRACE_ERR_BAD_PACKET,"Insufficient magic (%04x)",htons(((struct frame_t *)buffer)->magic)); 316 317 return -1; 317 318 } -
lib/libtraceio-stdio.c
r39e141f r4315572b 4 4 #include <sys/types.h> /* for ssize_t/off_t */ 5 5 #include <stdio.h> 6 #include <stdlib.h> 7 8 #include <errno.h> /* for debugging */ 6 9 7 10 struct libtrace_io_t { … … 11 14 ssize_t libtrace_io_read(libtrace_io_t *io, void *buf, size_t len) 12 15 { 13 return fread(buf,len,1,io->file); 16 int ret=fread(buf,1,len,io->file); 17 18 if (ret==(int)len) { 19 printf("read %i bytes\n",ret); 20 return len; 21 } 22 23 /* EOF or an Error occurred */ 24 if (ferror(io->file)) { 25 int err=errno; 26 perror("fread"); 27 errno=err; 28 /* errno will be set */ 29 return -1; 30 } 31 32 printf("eof\n"); 33 34 return 0; /* EOF */ 14 35 } 15 36
Note: See TracChangeset
for help on using the changeset viewer.