From 0f0f3d121939a3dd8a549837d02e3658ab199dfb Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 12 Dec 2019 15:15:31 +0000 Subject: [PATCH] Add DEBUG message when 7777 is not found at expected location --- src/grib_io.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/grib_io.c b/src/grib_io.c index 3802efa51..e87f6ed34 100644 --- a/src/grib_io.c +++ b/src/grib_io.c @@ -104,14 +104,18 @@ static int read_the_rest(reader* r,size_t message_length,unsigned char* tmp, int memcpy(buffer,tmp,already_read); - if((r->read(r->read_data,buffer+already_read,rest,&err) != rest) || err) + if((r->read(r->read_data,buffer+already_read,rest,&err) != rest) || err) { + /*fprintf(stderr, "read_the_rest: r->read failed: %s\n", grib_get_error_message(err));*/ return err; + } if(check7777 && !r->headers_only && (buffer[message_length-4] != '7' || buffer[message_length-3] != '7' || buffer[message_length-2] != '7' || - buffer[message_length-1] != '7')) { - + buffer[message_length-1] != '7')) + { + grib_context* c = grib_context_get_default(); + grib_context_log(c, GRIB_LOG_DEBUG, "read_the_rest: No final 7777 at expected location (Coded length=%lu)", message_length); return GRIB_WRONG_LENGTH; }