Changeset 4315572b for lib/format_wag.c


Ignore:
Timestamp:
04/23/06 14:11:01 (16 years ago)
Author:
Perry Lorier <perry@…>
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
Message:

Fixup stdio to be more standard compliant
Fix format wag to be more sensitive to errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_wag.c

    r222d8f5 r4315572b  
    298298        buffer2 = buffer = packet->buffer;
    299299
    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)) {
    302307                int err=errno;
    303308                trace_set_err(libtrace,err,
     
    307312        }
    308313
    309         if (numbytes == 0) {
    310                 return 0;
    311         }
    312 
    313314        if (htons(((struct frame_t *)buffer)->magic) != 0xdaa1) {
    314315                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));
    316317                return -1;
    317318        }
Note: See TracChangeset for help on using the changeset viewer.