From f6fe2dd0e6c9f50f4ee98025b1342e31be67dcdd Mon Sep 17 00:00:00 2001 From: gramanas Date: Mon, 29 Oct 2018 20:26:57 +0200 Subject: Make exit value -1 if error, 0 else. --- src/ck.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/ck.c') 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; } -- cgit v1.2.3