Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1, Table CRC Tool Fails To Close File Descriptor #5

Merged
merged 2 commits into from
Sep 10, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions cfe_ts_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>


#define CFE_ES_CRC_8 1 /**< \brief CRC ( 8 bit additive - returns 32 bit total) (Currently not implemented) */
Expand Down Expand Up @@ -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);
}