Changeset 2193905 for lib/format_ndag.c


Ignore:
Timestamp:
11/29/18 10:12:59 (2 years ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
fdf23b8
Parents:
d74ca03
Message:

Apply changes required for pull request #81

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_ndag.c

    r25a3255 r2193905  
    3535#include "format_erf.h"
    3636
    37 #include <assert.h>
    3837#include <errno.h>
    3938#include <fcntl.h>
     
    287286
    288287        if (!libtrace->format_data) {
    289                 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, "Unable to allocate memory ndag_init_input()");
     288                trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, "Unable to allocate memory for "
     289                        "format data inside ndag_init_input()");
    290290                return -1;
    291291        }
     
    658658        ssock->nextts = 0;
    659659
    660         /*assert(ssock->nextread - ssock->saved[nr] <= ssock->savedsize[nr]);*/
    661660        if (ssock->nextread - ssock->saved[nr] > ssock->savedsize[nr]) {
    662                 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, "Failed to prepare packet stream in ndag_prepare_packet_stream()");
     661                trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, "Walked past the end of the "
     662                        "nDAG receive buffer, probably due to a invalid rlen, in ndag_prepare_packet_stream()");
    663663                return -1;
    664664        }
     
    689689                uint32_t flags UNUSED) {
    690690
    691         /*assert(0 && "Sending nDAG records over RT doesn't make sense! Please stop.");*/
    692691        fprintf(stderr, "Sending nDAG records over RT doesn't make sense! Please stop\n");
    693692        return 0;
     
    873872        }
    874873#else
    875         /*assert(required > 0);*/
    876874        if (required <= 0) {
    877                 fprintf(stderr, "You are required to have atleast 1 receiver in init_reveivers\n");
     875                fprintf(stderr, "You are required to have atleast 1 receiver in init_receivers\n");
    878876                return TRACE_ERR_INIT_FAILED;
    879877        }
     
    912910        ssock->bufavail --;
    913911
    914         /*assert(ssock->bufavail >= 0);*/
    915912        if (ssock->bufavail < 0) {
    916913                fprintf(stderr, "No space in buffer in check_ndag_received()\n");
     
    12991296                src->bufavail += src->bufwaiting;
    13001297                src->bufwaiting = 0;
    1301                 /*assert(src->bufavail >= 0 && src->bufavail <= ENCAP_BUFFERS);*/
    1302                 if (src->bufavail < 0 && src->bufavail > ENCAP_BUFFERS) {
     1298                if (src->bufavail < 0 || src->bufavail > ENCAP_BUFFERS) {
    13031299                        trace_set_err(libtrace, TRACE_ERR_BAD_IO, "Not enough buffer space in ndag_pread_packets()");
    13041300                        return -1;
     
    13921388                src->bufavail += src->bufwaiting;
    13931389                src->bufwaiting = 0;
    1394                 /*assert(src->bufavail >= 0 && src->bufavail <= ENCAP_BUFFERS);*/
    1395                 if (src->bufavail < 0 && src->bufavail > ENCAP_BUFFERS) {
     1390                if (src->bufavail < 0 || src->bufavail > ENCAP_BUFFERS) {
    13961391                        trace_set_err(libtrace, TRACE_ERR_BAD_IO, "Not enough buffer space in trace_event_ndag()");
    1397                         break; /* breaking here cause error above also does? */
     1392                        break;
    13981393                }
    13991394        }
Note: See TracChangeset for help on using the changeset viewer.