From: Mauro Carvalho Chehab Date: Tue, 26 Feb 2013 14:30:50 +0000 (-0300) Subject: kbuffer-parse: print error if kbuffer_alloc fails X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f3ecce68bd2b2a8dc83d78eb57fe918cc88c2be1;p=users%2Fmchehab%2Fedactool.git kbuffer-parse: print error if kbuffer_alloc fails if one of the size/endian verification tests fail, kbuffer_alloc fails, but errno is not set. Add a print for those situations. Signed-off-by: Mauro Carvalho Chehab --- diff --git a/kbuffer-parse.c b/kbuffer-parse.c index 40d00c0..2d0f341 100644 --- a/kbuffer-parse.c +++ b/kbuffer-parse.c @@ -37,7 +37,7 @@ enum { }; #define ENDIAN_MASK (KBUFFER_FL_HOST_BIG_ENDIAN | KBUFFER_FL_BIG_ENDIAN) - + /** kbuffer * @timestamp - timestamp of current event * @lost_events - # of lost events between this subbuffer and previous @@ -189,6 +189,7 @@ kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian) flags |= KBUFFER_FL_LONG_8; break; default: + fprintf(stderr, "buffer size %d is invalid\n", size); return NULL; } @@ -199,6 +200,7 @@ kbuffer_alloc(enum kbuffer_long_size size, enum kbuffer_endian endian) flags |= KBUFFER_FL_BIG_ENDIAN; break; default: + fprintf(stderr, "buffer endian %d is invalid\n", endian); return NULL; } @@ -605,7 +607,7 @@ unsigned long long kbuffer_timestamp(struct kbuffer *kbuf) * Returns the data of the record that is at @offset. Note, @offset does * not need to be the start of the record, the offset just needs to be * in the record (or beginning of it). - * + * * Note, the kbuf timestamp and pointers are updated to the * returned record. That is, kbuffer_read_event() will return the same * data and timestamp, and kbuffer_next_event() will increment from