From f4e6503d0a14df3081dcf6637c972821915dd545 Mon Sep 17 00:00:00 2001 From: avan989 Date: Tue, 10 Sep 2019 09:54:42 -0400 Subject: [PATCH] Fix #1, Close file descriptor --- cfe_ts_crc.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cfe_ts_crc.c b/cfe_ts_crc.c index eff9ff2..b1ce445 100644 --- a/cfe_ts_crc.c +++ b/cfe_ts_crc.c @@ -42,12 +42,10 @@ #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) */ -#define CFE_ES_CRC_32 3 /**< \brief CRC (32 bit additive - returns 32 bit total) (Currently not implemented) */ -#define CFE_ES_DEFAULT_CRC CFE_ES_CRC_16 /**< \brief mission specific CRC type */ +#include +#include +#include "cfe_tbl_filedef.h" +#include "cfe_fs.h" typedef unsigned char uint8; typedef unsigned short uint16; @@ -177,7 +175,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); }