Skip to content

Commit

Permalink
Fix #1, Close file descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
avan989 authored and skliper committed Sep 12, 2019
1 parent 66d67e4 commit f4e6503
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions cfe_ts_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,10 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>


#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 <stdlib.h>
#include <unistd.h>
#include "cfe_tbl_filedef.h"
#include "cfe_fs.h"

typedef unsigned char uint8;
typedef unsigned short uint16;
Expand Down Expand Up @@ -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);
}

0 comments on commit f4e6503

Please sign in to comment.