Changeset 85a0d42


Ignore:
Timestamp:
03/17/06 13:23:00 (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:
72cc9cc
Parents:
752709f
Message:

Fix up output, better reporting of output errors

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    reeab9832 r85a0d42  
    688688        int numbytes = 0;
    689689        assert(size<=65536);
    690         /* FIXME: Shouldn't this return != dag_record_size+pad on error? */
    691         if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, erfptr, dag_record_size + pad)) == 0) {
     690
     691        if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, erfptr, dag_record_size + pad)) != dag_record_size+pad) {
    692692                trace_set_err_out(libtrace,errno,
    693693                                "write(%s)",libtrace->uridata);
     
    695695        }
    696696
    697         if ((numbytes=LIBTRACE_WRITE(OUTPUT.file, buffer, size)) == 0) {
     697        if ((numbytes=LIBTRACE_WRITE(OUTPUT.file, buffer, size)) != size) {
    698698                trace_set_err_out(libtrace,errno,
    699699                                "write(%s)",libtrace->uridata);
     
    733733        }
    734734       
    735         if (libtrace->format == &erf 
     735        if (packet->trace->format == &erf 
    736736#if HAVE_DAG
    737                         || libtrace->format == &dag
     737                        || packet->trace->format == &dag
    738738#endif
    739739                        ) {
    740740                numbytes = erf_dump_packet(libtrace,
    741                                 (dag_record_t *)packet->buffer,
     741                                (dag_record_t *)packet->header,
    742742                                pad,
    743743                                payload,
  • lib/format_pcap.c

    r7ac9705 r85a0d42  
    298298                fflush((FILE *)OUTPUT.trace.dump);
    299299        }
    300         if (libtrace->format == &pcap ||
    301                         libtrace->format == &pcapint) {
    302                
     300        if (packet->trace->format == &pcap ||
     301                        packet->trace->format == &pcapint) {
    303302                pcap_dump((u_char*)OUTPUT.trace.dump,(struct pcap_pkthdr *)packet->header,packet->payload);
    304303        } else {
     
    311310                pcap_pkt_hdr.caplen = trace_get_capture_length(packet);
    312311                pcap_pkt_hdr.len = trace_get_wire_length(packet);
     312
     313                assert(pcap_pkt_hdr.caplen<65536);
     314                assert(pcap_pkt_hdr.len<65536);
    313315
    314316                pcap_dump((u_char*)OUTPUT.trace.dump, &pcap_pkt_hdr, packet->payload);
Note: See TracChangeset for help on using the changeset viewer.