diff options
Diffstat (limited to 'src/charon-cmd/charon-cmd.c')
-rw-r--r-- | src/charon-cmd/charon-cmd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/charon-cmd/charon-cmd.c b/src/charon-cmd/charon-cmd.c index 1293ec4c0..e85e21d5c 100644 --- a/src/charon-cmd/charon-cmd.c +++ b/src/charon-cmd/charon-cmd.c @@ -348,6 +348,9 @@ int main(int argc, char *argv[]) { exit(SS_RC_INITIALIZATION_FAILED); } + /* register this again after loading plugins to avoid issues with libraries + * that register atexit() handlers */ + atexit(libcharon_deinit); if (!lib->caps->drop(lib->caps)) { exit(SS_RC_INITIALIZATION_FAILED); @@ -358,9 +361,6 @@ int main(int argc, char *argv[]) creds = cmd_creds_create(); atexit(cleanup_creds); - /* handle all arguments */ - handle_arguments(argc, argv, FALSE); - if (uname(&utsname) != 0) { memset(&utsname, 0, sizeof(utsname)); @@ -369,6 +369,9 @@ int main(int argc, char *argv[]) VERSION, utsname.sysname, utsname.release, utsname.machine); lib->plugins->status(lib->plugins, LEVEL_CTRL); + /* handle all arguments */ + handle_arguments(argc, argv, FALSE); + /* add handler for SEGV and ILL, * INT, TERM and HUP are handled by sigwaitinfo() in run() */ action.sa_handler = segv_handler; |