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 #76, Replace exit(1) with preferred macro EXIT_FAILURE #77

Merged
Merged
Changes from all commits
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
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