From 13ce8bd13ddcdbb4dc14ea01c3504c933ae76b9c Mon Sep 17 00:00:00 2001 From: Jake Hageman Date: Mon, 16 Sep 2019 17:36:48 -0400 Subject: [PATCH] Fix #1, fix #2: Close file, add includes --- cfe_ts_crc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cfe_ts_crc.c b/cfe_ts_crc.c index eff9ff2..ad911a2 100644 --- a/cfe_ts_crc.c +++ b/cfe_ts_crc.c @@ -42,7 +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) */ #define CFE_ES_CRC_16 2 /**< \brief CRC (16 bit additive - returns 32 bit total) */ @@ -177,7 +178,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); + + /* Close file and check*/ + if( close(fd) != 0 ) + { + printf("\nerror: Cannot close file!\n"); + exit(0); + } - return(fileCRC); + return(fileCRC); }