]> www.infradead.org Git - users/mchehab/edactool.git/commitdiff
kbuffer-parse: print error if kbuffer_alloc fails
authorMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 26 Feb 2013 14:30:50 +0000 (11:30 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 26 Feb 2013 14:30:50 +0000 (11:30 -0300)
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 <mchehab@redhat.com>
kbuffer-parse.c

index 40d00c0ff91c4e1f9c020be2c18a61e926e52e49..2d0f3412e28c25e175df2b436f0ef024e789632a 100644 (file)
@@ -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