Skip to content

Commit 5b7eebf

Browse files
committed
Use the EXIT_FAIlURE for exit() on error
Consistently use the `EXIT_FAILURE` macro in case of `exit()` on error.
1 parent 9f63d37 commit 5b7eebf

7 files changed

+14
-14
lines changed

src/aiori-DFS.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ DFS_Xfer(int access, aiori_fd_t *file, IOR_size_t *buffer, IOR_offset_t length,
808808

809809
if (ret < remaining) {
810810
if (hints->singleXferAttempt == TRUE)
811-
exit(-1);
811+
exit(EXIT_FAILURE);
812812
if (xferRetries > MAX_RETRY)
813813
ERR("too many retries -- aborting");
814814
}

src/aiori-HDF5.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
if (strcmp(resultString, "Invalid minor error number") != 0) \
6161
fprintf(stdout, "%s\n", resultString); \
6262
fprintf(stdout, "** exiting **\n"); \
63-
exit(-1); \
63+
exit(EXIT_FAILURE); \
6464
} \
6565
} while(0)
6666
#else /* ! (H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6) */
@@ -75,7 +75,7 @@
7575
* char* mesg, size_t size) \
7676
*/ \
7777
fprintf(stdout, "** exiting **\n"); \
78-
exit(-1); \
78+
exit(EXIT_FAILURE); \
7979
} \
8080
} while(0)
8181
#endif /* H5_VERS_MAJOR > 1 && H5_VERS_MINOR > 6 */

src/aiori-NCMPI.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
__FILE__, __LINE__, MSG); \
4040
fprintf(stdout, "ERROR: %s.\n", ncmpi_strerror(NCMPI_RETURN)); \
4141
fprintf(stdout, "** exiting **\n"); \
42-
exit(-1); \
42+
exit(EXIT_FAILURE); \
4343
} \
4444
} while(0)
4545

src/aiori-S3-4c.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ static IOR_offset_t S3_Xfer_internal(int access,
841841
if (strlen(param->io_buf->eTag) != ETAG_SIZE+2) { /* quotes at both ends */
842842
fprintf(stderr, "Rank %d: ERROR: expected ETag to be %d hex digits\n",
843843
rank, ETAG_SIZE);
844-
exit(1);
844+
exit(EXIT_FAILURE);
845845
}
846846

847847
// save the eTag for later

src/md-workbench.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -851,12 +851,12 @@ static int return_position(){
851851
FILE * f = fopen(o.run_info_file, "r");
852852
if(! f){
853853
ERRF("[ERROR] Could not open %s for restart", o.run_info_file);
854-
exit(1);
854+
exit(EXIT_FAILURE);
855855
}
856856
ret = fscanf(f, "pos: %d", & position);
857857
if (ret != 1){
858858
ERRF("Could not read from %s for restart", o.run_info_file);
859-
exit(1);
859+
exit(EXIT_FAILURE);
860860
}
861861
fclose(f);
862862
}
@@ -871,7 +871,7 @@ static void store_position(int position){
871871
FILE * f = fopen(o.run_info_file, "w");
872872
if(! f){
873873
ERRF("[ERROR] Could not open %s for saving data", o.run_info_file);
874-
exit(1);
874+
exit(EXIT_FAILURE);
875875
}
876876
fprintf(f, "pos: %d\n", position);
877877
fclose(f);

src/option.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static void option_parse_token(char ** argv, int * flag_parsed_next, int * requi
315315
if(arg == NULL){
316316
const char str[] = {o->shortVar, 0};
317317
printf("Error, argument missing for option %s\n", (o->longVar != NULL) ? o->longVar : str);
318-
exit(1);
318+
exit(EXIT_FAILURE);
319319
}
320320

321321
switch(o->type){
@@ -460,7 +460,7 @@ int option_parse(int argc, char ** argv, options_all_t * opt_all){
460460
}
461461
option_print_help(args);
462462
}
463-
exit(0);
463+
exit(EXIT_FAILURE);
464464
}
465465

466466
return i;

src/parse_options.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt
9595
if (initialized)
9696
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error");
9797
else
98-
exit(-1);
98+
exit(EXIT_FAILURE);
9999
}
100100
if (strcasecmp(option, "api") == 0) {
101101
params->api = strdup(value);
102102

103103
params->backend = aiori_select(params->api);
104104
if (params->backend == NULL){
105105
fprintf(out_logfile, "Could not load backend API %s\n", params->api);
106-
exit(-1);
106+
exit(EXIT_FAILURE);
107107
}
108108
} else if (strcasecmp(option, "summaryFile") == 0) {
109109
if (rank == 0){
@@ -258,7 +258,7 @@ void DecodeDirective(char *line, IOR_param_t *params, options_all_t * module_opt
258258
if (initialized)
259259
MPI_CHECK(MPI_Abort(MPI_COMM_WORLD, -1), "MPI_Abort() error");
260260
else
261-
exit(-1);
261+
exit(EXIT_FAILURE);
262262
}
263263
}
264264
}
@@ -285,7 +285,7 @@ void ParseLine(char *line, IOR_param_t * test, options_all_t * module_options)
285285
}
286286
if(strlen(start) < 3){
287287
fprintf(out_logfile, "Invalid option substring string: \"%s\" in \"%s\"\n", start, line);
288-
exit(1);
288+
exit(EXIT_FAILURE);
289289
}
290290
DecodeDirective(start, test, module_options);
291291
start = end + 1;

0 commit comments

Comments
 (0)