Skip to content

Commit

Permalink
Merge pull request #77 from thnkslprpt/fix-76-replace-exit-1-with-EXI…
Browse files Browse the repository at this point in the history
…T_FAILURE

Fix #76, Replace exit(1) with preferred macro EXIT_FAILURE
  • Loading branch information
dzbaker committed Feb 27, 2023
2 parents 9abe3a7 + be50474 commit c64673c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cfe_ts_crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ int main(int argc, char **argv)
{
printf("%s\n", CFE_TS_CRC_VERSION_STRING);
printf("\nUsage: cfe_ts_crc [filename]\n");
exit(1);
exit(EXIT_FAILURE);
}
/* Set to skip the header (116 bytes) */
skipSize = sizeof(CFE_FS_Header_t) + sizeof(CFE_TBL_File_Hdr_t);
Expand All @@ -125,15 +125,15 @@ int main(int argc, char **argv)
{
printf("\ncfe_ts_crc error: can't open input file!\n");
perror(argv[1]);
exit(1);
exit(EXIT_FAILURE);
}
/* seek past the number of bytes requested */
offsetReturn = lseek(fd, skipSize, SEEK_SET);
if (offsetReturn != skipSize)
{
printf("\ncfe_ts_crc error: lseek failed!\n");
printf("%s\n", strerror(errno));
exit(1);
exit(EXIT_FAILURE);
}

/* read the input file 100 bytes at a time */
Expand All @@ -144,7 +144,7 @@ int main(int argc, char **argv)
{
printf("\ncfe_ts_crc error: file read failed!\n");
printf("%s\n", strerror(errno));
exit(1);
exit(EXIT_FAILURE);
}
fileCRC = CalculateCRC(buffer, readSize, fileCRC);
fileSize += readSize;
Expand All @@ -160,7 +160,7 @@ int main(int argc, char **argv)
{
printf("\nerror: Cannot close file!\n");
printf("%s\n", strerror(errno));
exit(1);
exit(EXIT_FAILURE);
}

return 0;
Expand Down

0 comments on commit c64673c

Please sign in to comment.