From d9ff82b01215eafe99d8ce37ad4288427f612940 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Mon, 26 Apr 2021 08:10:06 +0200 Subject: [PATCH] test init_gpio_mapping return value Signed-off-by: Michel-FK --- main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 7b4bc9d..cc26b80 100644 --- a/main.c +++ b/main.c @@ -225,7 +225,17 @@ int main(int argc, char *argv[]) init_uinput(); /* Initialize the GPIO mapping */ - init_gpio_mapping(config_file, &mapping_list); + if (init_gpio_mapping(config_file, &mapping_list) == false) { + + /* Close the uinput device */ + close_uinput(); + if (daemon) { + + /* Close the syslog */ + closelog(); + } + exit(EXIT_FAILURE); + } while (true) { /* Main loop to handle the GPIOs */ @@ -242,5 +252,5 @@ int main(int argc, char *argv[]) /* Close the syslog */ closelog(); } - return EXIT_SUCCESS; + return EXIT_SUCCESS; }