From 31a2f609ec040429706d3a603d438683f205eb82 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sat, 17 Apr 2010 21:24:36 +0200 Subject: [PATCH] Changed the exit(1) to exit(EXIT_FAILURE). --- breezed.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/breezed.c b/breezed.c index 42a830b..5d57861 100644 --- a/breezed.c +++ b/breezed.c @@ -82,7 +82,7 @@ char *next_word(char *buffer, char *r, int buffer_size) { (*r != '\t') && (*r != ' ') && (*r != ',')) { if(s == buffer + buffer_size) { fprintf(stderr, "Buffer overflow in next_word.\n"); - exit(1); + exit(EXIT_FAILURE); } *s++ = *r++; } @@ -103,7 +103,7 @@ void set_fan_level(int fan_fd, int f, int max_fan_level) { if(write(fan_fd, buffer, strlen(buffer)) < 0) { fprintf(stderr, "Error in setting the fan level (%s).\n", strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } } @@ -112,7 +112,7 @@ void define_thermal_files(char *definition) { if(file_thermal) { fprintf(stderr, "Thermal files already defined.\n"); - exit(1); + exit(EXIT_FAILURE); } char *s; @@ -138,7 +138,7 @@ void define_temperature_thresholds(char *definition) { if(temperature_thresholds) { fprintf(stderr, "Temperature thresholds already defined.\n"); - exit(1); + exit(EXIT_FAILURE); } nb_temperature_thresholds = 1; @@ -179,7 +179,7 @@ void evaluate_one_configuration_line(char *line, int line_number) { if(s == 0) { fprintf(stderr, "Missing parameter in %s:%d\n", configuration_file, line_number); - exit(1); + exit(EXIT_FAILURE); } define_thermal_files(s); } @@ -191,12 +191,12 @@ void evaluate_one_configuration_line(char *line, int line_number) { else if(strcmp(token, "fan_file") == 0) { if(file_fan) { fprintf(stderr, "Fan file already defined.\n"); - exit(1); + exit(EXIT_FAILURE); } if(s == 0) { fprintf(stderr, "Missing parameter in %s:%d\n", configuration_file, line_number); - exit(1); + exit(EXIT_FAILURE); } file_fan = strdup(s); } @@ -205,7 +205,7 @@ void evaluate_one_configuration_line(char *line, int line_number) { if(s == 0) { fprintf(stderr, "Missing parameter in %s:%d\n", configuration_file, line_number); - exit(1); + exit(EXIT_FAILURE); } define_temperature_thresholds(s); } @@ -213,7 +213,7 @@ void evaluate_one_configuration_line(char *line, int line_number) { else if(token[0] && token[0] != '#') { fprintf(stderr, "Unknown keyword '%s' in %s:%d.\n", token, configuration_file, line_number); - exit(1); + exit(EXIT_FAILURE); } } @@ -251,7 +251,7 @@ int main(int argc, char **argv) { i++; if(i == argc) { fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]); - exit(1); + exit(EXIT_FAILURE); } free(configuration_file); @@ -265,7 +265,7 @@ int main(int argc, char **argv) { i++; if(i == argc) { fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]); - exit(1); + exit(EXIT_FAILURE); } define_thermal_files(argv[i]); i++; @@ -276,12 +276,12 @@ int main(int argc, char **argv) { i++; if(i == argc) { fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]); - exit(1); + exit(EXIT_FAILURE); } if(file_fan) { fprintf(stderr, "Fan file already defined.\n"); - exit(1); + exit(EXIT_FAILURE); } file_fan = strdup(argv[i]); @@ -294,7 +294,7 @@ int main(int argc, char **argv) { if(i == argc) { fprintf(stderr, "Missing parameter for %s.\n", argv[i - 1]); - exit(1); + exit(EXIT_FAILURE); } define_temperature_thresholds(argv[i]); @@ -348,7 +348,7 @@ Written by Francois Fleuret (francois@fleuret.org).\n", else { fprintf(stderr, "Unknown argument %s.\n", argv[i]); - exit(1); + exit(EXIT_FAILURE); } } @@ -364,7 +364,7 @@ Written by Francois Fleuret (francois@fleuret.org).\n", if(!file) { fprintf(stderr, "Can not open `%s' for reading.\n", configuration_file); - exit(1); + exit(EXIT_FAILURE); } start = 0; @@ -404,7 +404,7 @@ Written by Francois Fleuret (francois@fleuret.org).\n", buffer_size); fprintf(stderr, raw_line); fprintf(stderr, "\n"); - exit(1); + exit(EXIT_FAILURE); } /* If we got a line, we replace the carriage return by a \0 to @@ -432,17 +432,17 @@ Written by Francois Fleuret (francois@fleuret.org).\n", if(nb_temperature_thresholds == 0) { fprintf(stderr, "No temperature threshold was provided.\n"); - exit(1); + exit(EXIT_FAILURE); } if(nb_file_thermal == 0) { fprintf(stderr, "No thermal file was provided.\n"); - exit(1); + exit(EXIT_FAILURE); } if(file_fan == 0){ fprintf(stderr, "No fan file was provided.\n"); - exit(1); + exit(EXIT_FAILURE); } for(i = 0; i < nb_file_thermal; i++) { @@ -450,7 +450,7 @@ Written by Francois Fleuret (francois@fleuret.org).\n", if(file_thermal_fd[i] < 0) { fprintf(stderr, "Can not open %s for reading (%s).\n", file_thermal[i], strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } } @@ -459,7 +459,7 @@ Written by Francois Fleuret (francois@fleuret.org).\n", if(file_fan_fd < 0) { fprintf(stderr, "Can not open %s for writing (%s).\n", file_fan, strerror(errno)); - exit(1); + exit(EXIT_FAILURE); } /******************************************************************/ @@ -540,13 +540,13 @@ Written by Francois Fleuret (francois@fleuret.org).\n", fprintf(stderr, "Error while reading %s (too large).\n", file_thermal[i]); } - exit(1); + exit(EXIT_FAILURE); } } if(temperature < 0) { fprintf(stderr, "Could not read a meaningful temperature.\n"); - exit(1); + exit(EXIT_FAILURE); } nb_rounds_since_last_change++; @@ -576,7 +576,7 @@ Written by Francois Fleuret (francois@fleuret.org).\n", /* We set it every time, even when there is no change, to handle when the level has been modified somewhere else (for instance - when combing back from suspend). */ + when coming back from suspend). */ set_fan_level(file_fan_fd, new_level, nb_temperature_thresholds - 1); -- 2.20.1