diff options
author | Erich Eckner <git@eckner.net> | 2018-11-01 10:31:05 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-11-01 10:31:05 +0100 |
commit | bb38fc49c776ded2847778befc7ffb63d24b7f9f (patch) | |
tree | aa2996228de087c91ef2240ab7f4dec192990967 /anzeige.c | |
parent | 98f209d3395b8ea0470c8d7b3531020741208b86 (diff) | |
download | anzeige-bb38fc49c776ded2847778befc7ffb63d24b7f9f.tar.xz |
turn off display before exiting
Diffstat (limited to 'anzeige.c')
-rw-r--r-- | anzeige.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -30,7 +30,7 @@ int main(int argc, char **argv) // Set up gpi pointer for direct register access ret_val = multiplexer_setup_root(); if (ret_val) - exit(ret_val); + return ret_val; // Drop root privileges drop_privileges(); @@ -65,7 +65,8 @@ int main(int argc, char **argv) text_buffer = malloc(TEXT_BUFFER_LENGTH); if (text_buffer == NULL) { fprintf(stderr, "malloc failed to allocate %d bytes\n", TEXT_BUFFER_LENGTH); - exit(EXIT_FAILURE); + turn_off_display(); + return EXIT_FAILURE; } time_t next_update = 0; @@ -84,6 +85,7 @@ int main(int argc, char **argv) if (text_buffer_end == NULL) { fprintf(stderr, "gadgets_retrieve_weather_warnings failed\n"); free(text_buffer); + turn_off_display(); return EXIT_FAILURE; } if (text_buffer + TEXT_BUFFER_LENGTH - text_buffer_end > 0) @@ -92,6 +94,7 @@ int main(int argc, char **argv) if (text_buffer_end == NULL) { fprintf(stderr, "gadgets_retrieve_current_temperature failed\n"); free(text_buffer); + turn_off_display(); return EXIT_FAILURE; } if (text_buffer + TEXT_BUFFER_LENGTH - text_buffer_end > 0) @@ -100,6 +103,7 @@ int main(int argc, char **argv) if (text_buffer_end == NULL) { fprintf(stderr, "gadgets_retrieve_weather_forecast failed\n"); free(text_buffer); + turn_off_display(); return EXIT_FAILURE; } if (text_buffer + TEXT_BUFFER_LENGTH - text_buffer_end > 0) @@ -121,8 +125,9 @@ int main(int argc, char **argv) free(text_buffer); pthread_join(scroll_data . thread_id, NULL); + turn_off_display(); - return 0; + return EXIT_SUCCESS; } // main |