summaryrefslogtreecommitdiff
path: root/src/charon-systemd/charon-systemd.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2019-01-02 10:45:36 +0100
committerYves-Alexis Perez <corsac@debian.org>2019-01-02 11:07:05 +0100
commit918094fde55fa0dbfd59a5f88d576efb513a88db (patch)
tree61e31656c60a6cc928c50cd633568043673e2cbd /src/charon-systemd/charon-systemd.c
parent69bc96f6b0b388d35e983f8d27224fa49d92918c (diff)
downloadvyos-strongswan-918094fde55fa0dbfd59a5f88d576efb513a88db.tar.gz
vyos-strongswan-918094fde55fa0dbfd59a5f88d576efb513a88db.zip
New upstream version 5.7.2
Diffstat (limited to 'src/charon-systemd/charon-systemd.c')
-rw-r--r--src/charon-systemd/charon-systemd.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/charon-systemd/charon-systemd.c b/src/charon-systemd/charon-systemd.c
index d06c26974..7d4465ebf 100644
--- a/src/charon-systemd/charon-systemd.c
+++ b/src/charon-systemd/charon-systemd.c
@@ -322,6 +322,7 @@ int main(int argc, char *argv[])
{
struct sigaction action;
struct utsname utsname;
+ int status = SS_RC_INITIALIZATION_FAILED;
dbg = dbg_stderr;
@@ -345,16 +346,15 @@ int main(int argc, char *argv[])
sd_notifyf(0, "STATUS=integrity check of charon-systemd failed");
return SS_RC_INITIALIZATION_FAILED;
}
- atexit(libcharon_deinit);
if (!libcharon_init())
{
sd_notifyf(0, "STATUS=libcharon initialization failed");
- return SS_RC_INITIALIZATION_FAILED;
+ goto error;
}
if (!lookup_uid_gid())
{
sd_notifyf(0, "STATUS=unknown uid/gid");
- return SS_RC_INITIALIZATION_FAILED;
+ goto error;
}
/* we registered the journal logger as custom logger, which gets its
* settings from <ns>.customlog.journal, let it fallback to <ns>.journal */
@@ -370,14 +370,14 @@ int main(int argc, char *argv[])
lib->settings->get_str(lib->settings, "%s.load", PLUGINS, lib->ns)))
{
sd_notifyf(0, "STATUS=charon initialization failed");
- return SS_RC_INITIALIZATION_FAILED;
+ goto error;
}
lib->plugins->status(lib->plugins, LEVEL_CTRL);
if (!lib->caps->drop(lib->caps))
{
sd_notifyf(0, "STATUS=dropping capabilities failed");
- return SS_RC_INITIALIZATION_FAILED;
+ goto error;
}
/* add handler for SEGV and ILL,
@@ -401,5 +401,9 @@ int main(int argc, char *argv[])
sd_notifyf(0, "STATUS=charon-systemd running, strongSwan %s, %s %s, %s",
VERSION, utsname.sysname, utsname.release, utsname.machine);
- return run();
+ status = run();
+
+error:
+ libcharon_deinit();
+ return status;
}