commit f000c590e9058ea2aa788c76d6d055ffa42882e0
parent 92fb7aa573843047090b1e7cd7921eab2853f7b1
Author: Frederic Cambus <fred@statdns.com>
Date: Sun, 16 Apr 2017 21:24:42 +0200
Use return instead of exit in main()
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -278,7 +278,7 @@ int main(int argc, char *argv[]) {
FILE *input_file = fopen(input, "r");
if (input_file == NULL) {
perror("File error");
- exit (1);
+ return 1;
}
// get the file size (bytes)
@@ -297,13 +297,13 @@ int main(int argc, char *argv[]) {
inputFileBuffer = (unsigned char *) malloc(sizeof(unsigned char)*inputFileSize + 1);
if (inputFileBuffer == NULL) {
perror("Memory error");
- exit (2);
+ return 2;
}
// copy the file into the buffer
if (fread(inputFileBuffer, 1, inputFileSize, input_file) != inputFileSize) {
perror("Reading error");
- exit (3);
+ return 3;
} // whole file is now loaded into inputFileBuffer
inputFileBuffer[inputFileSize] = '\0';