3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

client: Set EXIT_FAILURE on SIGTERM/SIGINT

This commit is contained in:
Denis Kenzior 2020-08-18 16:32:46 -05:00
parent 5140c005c1
commit 9b459c1943

View File

@ -32,12 +32,15 @@
#include "client/display.h" #include "client/display.h"
#include "client/dbus-proxy.h" #include "client/dbus-proxy.h"
static int exit_status = EXIT_SUCCESS;
static void signal_handler(uint32_t signo, void *user_data) static void signal_handler(uint32_t signo, void *user_data)
{ {
switch (signo) { switch (signo) {
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:
display("Terminate\n"); display("Terminate\n");
exit_status = EXIT_FAILURE;
l_main_quit(); l_main_quit();
break; break;
} }
@ -45,7 +48,6 @@ static void signal_handler(uint32_t signo, void *user_data)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int exit_status;
bool all_done; bool all_done;
if (!l_main_init()) if (!l_main_init())
@ -70,7 +72,8 @@ int main(int argc, char *argv[])
display_exit(); display_exit();
done: done:
exit_status = command_get_exit_status(); if (!exit_status)
exit_status = command_get_exit_status();
command_exit(); command_exit();