aboutsummaryrefslogtreecommitdiffstats
path: root/src/swanctl/commands/install.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-10-09 16:48:29 +0200
committerMartin Willi <martin@revosec.ch>2014-10-10 11:42:18 +0200
commit67f9f09dd3aec23f8ebc514220c53833996dd1ea (patch)
tree725d2f77744e47d950c673aa61963542d1ea38db /src/swanctl/commands/install.c
parentd4d85135c5713f3bddebdc5ccc3c0bf0fa4b022a (diff)
downloadstrongswan-67f9f09dd3aec23f8ebc514220c53833996dd1ea.tar.bz2
strongswan-67f9f09dd3aec23f8ebc514220c53833996dd1ea.tar.xz
swanctl: Fix exit codes based on errno
As fprintf() most likely sets errno, we should save it before printing the error message.
Diffstat (limited to 'src/swanctl/commands/install.c')
-rw-r--r--src/swanctl/commands/install.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/swanctl/commands/install.c b/src/swanctl/commands/install.c
index e8727d573..59c5c24ab 100644
--- a/src/swanctl/commands/install.c
+++ b/src/swanctl/commands/install.c
@@ -55,8 +55,9 @@ static int manage_policy(vici_conn_t *conn, char *label)
res = vici_submit(req, conn);
if (!res)
{
+ ret = errno;
fprintf(stderr, "%s request failed: %s\n", label, strerror(errno));
- return errno;
+ return ret;
}
if (format & COMMAND_FORMAT_RAW)
{