From 10c4f4e1fd572d731aaf0c456dfa9dcd7894a554 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 22 Jan 2014 14:39:41 +0100 Subject: libhydra: Remove unused hydra->daemon --- src/charon-cmd/charon-cmd.c | 2 +- src/charon-nm/charon-nm.c | 2 +- src/charon-tkm/src/charon-tkm.c | 2 +- src/charon-tkm/tests/tests.c | 2 +- src/charon/charon.c | 2 +- src/conftest/conftest.c | 2 +- src/frontends/android/jni/libandroidbridge/charonservice.c | 2 +- src/frontends/osx/charon-xpc/charon-xpc.c | 2 +- src/libhydra/hydra.c | 4 +--- src/libhydra/hydra.h | 12 ++---------- src/starter/starter.c | 2 +- 11 files changed, 12 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/charon-cmd/charon-cmd.c b/src/charon-cmd/charon-cmd.c index 13f97856f..e7e0c9db0 100644 --- a/src/charon-cmd/charon-cmd.c +++ b/src/charon-cmd/charon-cmd.c @@ -334,7 +334,7 @@ int main(int argc, char *argv[]) } } atexit(libhydra_deinit); - if (!libhydra_init("charon-cmd")) + if (!libhydra_init()) { exit(SS_RC_INITIALIZATION_FAILED); } diff --git a/src/charon-nm/charon-nm.c b/src/charon-nm/charon-nm.c index 12667ab19..830d44b39 100644 --- a/src/charon-nm/charon-nm.c +++ b/src/charon-nm/charon-nm.c @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) exit(SS_RC_DAEMON_INTEGRITY); } - if (!libhydra_init("charon-nm")) + if (!libhydra_init()) { dbg_syslog(DBG_DMN, 1, "initialization failed - aborting charon-nm"); libhydra_deinit(); diff --git a/src/charon-tkm/src/charon-tkm.c b/src/charon-tkm/src/charon-tkm.c index 1e9fecd2d..1b9fc1cfb 100644 --- a/src/charon-tkm/src/charon-tkm.c +++ b/src/charon-tkm/src/charon-tkm.c @@ -256,7 +256,7 @@ int main(int argc, char *argv[]) exit(status); } - if (!libhydra_init(dmn_name)) + if (!libhydra_init()) { dbg_syslog(DBG_DMN, 1, "initialization failed - aborting %s", dmn_name); libhydra_deinit(); diff --git a/src/charon-tkm/tests/tests.c b/src/charon-tkm/tests/tests.c index 5bbacacf3..7a2556547 100644 --- a/src/charon-tkm/tests/tests.c +++ b/src/charon-tkm/tests/tests.c @@ -50,7 +50,7 @@ static bool test_runner_init(bool init) if (init) { - libhydra_init("test_runner"); + libhydra_init(); libcharon_init("test_runner"); lib->settings->set_int(lib->settings, "test_runner.filelog.stdout.default", 0); diff --git a/src/charon/charon.c b/src/charon/charon.c index d79969125..8a89c763e 100644 --- a/src/charon/charon.c +++ b/src/charon/charon.c @@ -303,7 +303,7 @@ int main(int argc, char *argv[]) exit(SS_RC_DAEMON_INTEGRITY); } - if (!libhydra_init("charon")) + if (!libhydra_init()) { dbg_stderr(DBG_DMN, 1, "initialization failed - aborting charon"); libhydra_deinit(); diff --git a/src/conftest/conftest.c b/src/conftest/conftest.c index d935058cb..d26991f9f 100644 --- a/src/conftest/conftest.c +++ b/src/conftest/conftest.c @@ -440,7 +440,7 @@ int main(int argc, char *argv[]) library_deinit(); return SS_RC_LIBSTRONGSWAN_INTEGRITY; } - if (!libhydra_init("conftest")) + if (!libhydra_init()) { libhydra_deinit(); library_deinit(); diff --git a/src/frontends/android/jni/libandroidbridge/charonservice.c b/src/frontends/android/jni/libandroidbridge/charonservice.c index d5a68bbc1..b50d5ace6 100644 --- a/src/frontends/android/jni/libandroidbridge/charonservice.c +++ b/src/frontends/android/jni/libandroidbridge/charonservice.c @@ -611,7 +611,7 @@ JNI_METHOD(CharonVpnService, initializeCharon, jboolean, set_options(logfile); free(logfile); - if (!libhydra_init("charon")) + if (!libhydra_init()) { libhydra_deinit(); library_deinit(); diff --git a/src/frontends/osx/charon-xpc/charon-xpc.c b/src/frontends/osx/charon-xpc/charon-xpc.c index 74ad2140b..4b7cd3a50 100644 --- a/src/frontends/osx/charon-xpc/charon-xpc.c +++ b/src/frontends/osx/charon-xpc/charon-xpc.c @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) } } atexit(libhydra_deinit); - if (!libhydra_init("charon-xpc")) + if (!libhydra_init()) { exit(SS_RC_INITIALIZATION_FAILED); } diff --git a/src/libhydra/hydra.c b/src/libhydra/hydra.c index f531bd5f4..1b5065081 100644 --- a/src/libhydra/hydra.c +++ b/src/libhydra/hydra.c @@ -59,7 +59,6 @@ void libhydra_deinit() this->public.attributes->destroy(this->public.attributes); this->public.kernel_interface->destroy(this->public.kernel_interface); - free((void*)this->public.daemon); free(this); hydra = NULL; } @@ -67,7 +66,7 @@ void libhydra_deinit() /** * Described in header. */ -bool libhydra_init(const char *daemon) +bool libhydra_init() { private_hydra_t *this; @@ -81,7 +80,6 @@ bool libhydra_init(const char *daemon) INIT(this, .public = { .attributes = attribute_manager_create(), - .daemon = strdup(daemon ?: "libhydra"), }, .ref = 1, ); diff --git a/src/libhydra/hydra.h b/src/libhydra/hydra.h index 2a8709d72..94209ff59 100644 --- a/src/libhydra/hydra.h +++ b/src/libhydra/hydra.h @@ -53,11 +53,6 @@ struct hydra_t { * kernel interface to communicate with kernel */ kernel_interface_t *kernel_interface; - - /** - * name of the daemon that initialized the library - */ - const char *daemon; }; /** @@ -70,15 +65,12 @@ extern hydra_t *hydra; /** * Initialize libhydra. * - * The daemon's name is used to load daemon-specific settings. - * * libhydra_init() may be called multiple times in a single process, but each - * caller should call libhydra_deinit() for each call to libhydra_init(). + * caller must call libhydra_deinit() for each call to libhydra_init(). * - * @param daemon name of the daemon that initializes the library * @return FALSE if integrity check failed */ -bool libhydra_init(const char *daemon); +bool libhydra_init(); /** * Deinitialize libhydra. diff --git a/src/starter/starter.c b/src/starter/starter.c index 87ad66dd9..33916c95c 100644 --- a/src/starter/starter.c +++ b/src/starter/starter.c @@ -422,7 +422,7 @@ int main (int argc, char **argv) library_init(NULL, "starter"); atexit(library_deinit); - libhydra_init("starter"); + libhydra_init(); atexit(libhydra_deinit); /* parse command line */ -- cgit v1.2.3