From 9526201f0237556d3e8d87d850642b48f6769148 Mon Sep 17 00:00:00 2001 From: avan989 Date: Thu, 29 Aug 2019 13:50:59 -0400 Subject: [PATCH] Table CRC Tool Fails To Close File Descriptor, # 1 --- cfe_ts_crc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cfe_ts_crc.c b/cfe_ts_crc.c index eff9ff2..05bd422 100644 --- a/cfe_ts_crc.c +++ b/cfe_ts_crc.c @@ -42,6 +42,8 @@ #include #include #include +#include +#include #define CFE_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */ @@ -177,7 +179,14 @@ int main( int argc, char **argv ) if (readSize != 100) done=1; } /* print the size/CRC results */ - printf("\nTable File Name: %s\nTable Size: %d Bytes\nExpected TS Validation CRC: 0x%08X\n\n", argv[1], fileSize, fileCRC); + printf("\nTable File Name: %s\nTable Size: %d Bytes\nExpected TS Validation CRC: 0x%08X\n\n", argv[1], fileSize, fileCRC); - return(fileCRC); + /* Close file and check*/ + if( close(fd) != 0 ) + { + printf("\nerror: Cannot close file!\n"); + exit(0); + } + + return(fileCRC); }