aboutsummaryrefslogtreecommitdiffstats
path: root/src/ck.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-10-29 20:26:57 +0200
committergramanas <anastasis.gramm2@gmail.com>2018-10-29 20:26:57 +0200
commitf6fe2dd0e6c9f50f4ee98025b1342e31be67dcdd (patch)
treef28ff7595a7c363d398114dae4d717067c28b906 /src/ck.c
parent5683c51d17b5eed7d2f070aa4e49cc21b65d82e5 (diff)
downloadck-f6fe2dd0e6c9f50f4ee98025b1342e31be67dcdd.tar.gz
ck-f6fe2dd0e6c9f50f4ee98025b1342e31be67dcdd.tar.bz2
ck-f6fe2dd0e6c9f50f4ee98025b1342e31be67dcdd.zip
Make exit value -1 if error, 0 else.
Diffstat (limited to 'src/ck.c')
-rw-r--r--src/ck.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ck.c b/src/ck.c
index 6e4248e..1370008 100644
--- a/src/ck.c
+++ b/src/ck.c
@@ -39,6 +39,7 @@ ERRLOG(main);
int main(int argc, const char **argv) {
UserOpt opt;
Conf conf;
+ int rc = -1;
initialize_errlog(argc, argv);
initialize_conf(&conf);
@@ -64,9 +65,10 @@ int main(int argc, const char **argv) {
/* Run action and print results */
switch(opt.action) {
-#define X(ACTION) \
- case CKA_##ACTION: \
- print_##ACTION##_result(run_##ACTION(&opt, &conf)); \
+#define X(ACTION) \
+ case CKA_##ACTION: \
+ rc = run_##ACTION(&opt, &conf); \
+ print_##ACTION##_result(rc); \
break;
CK_ACTIONS
#undef X
@@ -77,5 +79,5 @@ int main(int argc, const char **argv) {
free_user_opt(&opt);
free_conf(&conf);
report_errlog();
- return 0;
+ return rc;
}