aboutsummaryrefslogtreecommitdiffstats
path: root/src/ck.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ck.c')
-rw-r--r--src/ck.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/ck.c b/src/ck.c
index 61797b4..98190b1 100644
--- a/src/ck.c
+++ b/src/ck.c
@@ -26,30 +26,24 @@ int main(int argc, char *argv[]) {
if (opt.action != CKA_INIT) {
if (!db_exists(&opt)) {
printf("ck is not initialized in %s.\nRun ck init first.\n", opt.confDir);
+ free_user_opt(&opt);
return 1;
}
if (!config_file_parse(&conf, &opt)) {
+ free_user_opt(&opt);
return 1;
}
}
- int ok;
- switch(opt.action) {
-#define X(ACTION) \
- case CKA_##ACTION: \
- ok = run_##ACTION(&opt, &conf); \
- break;
- CK_ACTIONS
-#undef X
- }
+ /* Run action and print results */
switch(opt.action) {
-#define X(ACTION) \
- case CKA_##ACTION: \
- print_##ACTION##_result(ok); \
+#define X(ACTION) \
+ case CKA_##ACTION: \
+ print_##ACTION##_result(run_##ACTION(&opt, &conf)); \
break;
CK_ACTIONS
-#undef X
+#undef X
}
free_user_opt(&opt);
return 0;