From 6b58ab1a085a9b135f608cc2551a0cd350996e7f Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 17 Jul 2018 19:12:48 -0500 Subject: [PATCH] main: Simplify sim_auth_init There's no real reason why sim_auth_init should fail, so simplify the procedure and move declarations to iwd.h --- src/iwd.h | 3 +++ src/main.c | 9 ++------- src/simauth.c | 8 ++------ src/simauth.h | 4 ---- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/iwd.h b/src/iwd.h index 1d7156d6..7537482f 100644 --- a/src/iwd.h +++ b/src/iwd.h @@ -34,3 +34,6 @@ void iwd_shutdown(void); void network_init(); void network_exit(); + +void sim_auth_init(void); +void sim_auth_exit(void); diff --git a/src/main.c b/src/main.c index 0269d9dc..283184c9 100644 --- a/src/main.c +++ b/src/main.c @@ -409,12 +409,6 @@ int main(int argc, char *argv[]) goto done; } - if (!sim_auth_init()) { - l_error("Failed to start sim auth module"); - exit_status = EXIT_FAILURE; - goto done; - } - plugin_init(plugins, noplugins); genl = l_genl_new_default(); @@ -455,10 +449,12 @@ int main(int argc, char *argv[]) network_init(); known_networks_init(); rfkill_init(); + sim_auth_init(); exit_status = EXIT_SUCCESS; l_main_run(); + sim_auth_exit(); rfkill_exit(); known_networks_exit(); network_exit(); @@ -466,7 +462,6 @@ int main(int argc, char *argv[]) eapol_exit(); eap_exit(); plugin_exit(); - sim_auth_exit(); l_genl_family_unref(nl80211); diff --git a/src/simauth.c b/src/simauth.c index 698d44df..24be033a 100644 --- a/src/simauth.c +++ b/src/simauth.c @@ -25,6 +25,7 @@ #include #include +#include "iwd.h" #include "watchlist.h" #include "simauth.h" @@ -174,14 +175,9 @@ void sim_auth_cancel_request(struct iwd_sim_auth *auth, int id) auth->driver->cancel_request(auth, id); } -bool sim_auth_init(void) +void sim_auth_init(void) { auth_providers = l_queue_new(); - - if (!auth_providers) - return false; - - return true; } void sim_auth_exit(void) diff --git a/src/simauth.h b/src/simauth.h index 441a6636..8003ded5 100644 --- a/src/simauth.h +++ b/src/simauth.h @@ -147,7 +147,3 @@ int sim_auth_run_gsm(struct iwd_sim_auth *auth, const uint8_t *rands, int num_rands, sim_auth_run_gsm_cb_t cb, void *data); void sim_auth_cancel_request(struct iwd_sim_auth *auth, int id); - -bool sim_auth_init(void); - -void sim_auth_exit(void);