Changeset 9b097ea for lib


Ignore:
Timestamp:
08/02/10 15:47:08 (11 years ago)
Author:
Shane Alcock <salcock@…>
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:
4bbe9bd
Parents:
7aebb85
Message:
  • Fix byte-ordering issue with writing duck traces
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_duck.c

    rb5af22c r9b097ea  
    3232 */
    3333
     34#include "config.h"
    3435#include "libtrace.h"
    3536#include "libtrace_int.h"
    3637#include "format_helper.h"
    37 #include "config.h"
    3838#include "wandio.h"
    3939#include <stdlib.h>
     
    249249
    250250        int numbytes = 0;
     251        uint32_t duck_version;
     252
    251253        if (packet->type != TRACE_RT_DUCK_2_4
    252254                        && packet->type != TRACE_RT_DUCK_2_5) {
     
    260262        if (OUTPUT->dag_version == 0) {
    261263        /* Writing the DUCK version will help with reading it back in later! */
    262                 if ((numbytes = wandio_wwrite(OUTPUT->file, &packet->type,
    263                                 sizeof(packet->type))) != sizeof(uint32_t)){
     264                duck_version = bswap_host_to_le32(packet->type);
     265                if ((numbytes = wandio_wwrite(OUTPUT->file, &duck_version,
     266                                sizeof(duck_version))) != sizeof(uint32_t)){
    264267                        trace_set_err_out(libtrace, errno,
    265268                                        "Writing DUCK version failed");
Note: See TracChangeset for help on using the changeset viewer.