From efe5245e47201e1947ce0bf60990a7de2151e296 Mon Sep 17 00:00:00 2001 From: Alasdair G Kergon Date: Thu, 13 Nov 2014 12:26:43 +0000 Subject: [PATCH] pvck: Use non-zero exit status after failure. --- WHATS_NEW | 1 + tools/pvck.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 9859939a0..19f029b52 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.113 - ===================================== + Exit with non-zero status code when pvck encounters a problem. Fix clean_tree after activation/resume for cache target (2.02.112). Version 2.02.112 - 11th November 2014 diff --git a/tools/pvck.c b/tools/pvck.c index e45e77af6..0b868e8bc 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -18,9 +18,11 @@ int pvck(struct cmd_context *cmd, int argc, char **argv) { int i; + int ret_max = ECMD_PROCESSED; /* FIXME: validate cmdline options */ /* FIXME: what does the cmdline look like? */ + /* * Use what's on the cmdline directly, and avoid calling into * some of the other infrastructure functions, so as to avoid @@ -32,10 +34,12 @@ int pvck(struct cmd_context *cmd, int argc, char **argv) log_verbose("Scanning %s", argv[i]); dm_unescape_colons_and_at_signs(argv[i], NULL, NULL); - pv_analyze(cmd, argv[i], - arg_uint64_value(cmd, labelsector_ARG, - UINT64_C(0))); + if (!pv_analyze(cmd, argv[i], + arg_uint64_value(cmd, labelsector_ARG, UINT64_C(0)))) { + stack; + ret_max = ECMD_FAILED; + } } - return ECMD_PROCESSED; + return ret_max; }