From 8a19ebf4fb3de0f58ae4a03f837294c2b8cd37f4 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Sun, 20 Jan 2008 01:23:46 +0000 Subject: [PATCH] Fix pvs, vgs, lvs error exit status on some error paths. (note -o help is now considered error) --- WHATS_NEW | 1 + tools/reporter.c | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index b822e3c4b..e17923c22 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.32 - =================================== + Fix pvs, vgs, lvs error exit status on some error paths. Version 2.02.31 - 19th January 2008 =================================== diff --git a/tools/reporter.c b/tools/reporter.c index 83744dc96..44745f4b6 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -240,13 +240,13 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, opts = arg_str_value(cmd, options_ARG, ""); if (!opts || !*opts) { log_error("Invalid options string: %s", opts); - return 0; + return EINVALID_CMD_LINE; } if (*opts == '+') { if (!(str = dm_pool_alloc(cmd->mem, strlen(options) + strlen(opts) + 1))) { log_error("options string allocation failed"); - return 0; + return ECMD_FAILED; } strcpy(str, options); strcat(str, ","); @@ -273,8 +273,10 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, if (!(report_handle = report_init(cmd, options, keys, &report_type, separator, aligned, buffered, - headings))) - return_0; + headings))) { + stack; + return ECMD_FAILED; + } /* Ensure options selected are compatible */ if (report_type & SEGS) @@ -284,7 +286,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, if ((report_type & LVS) && (report_type & PVS) && !args_are_pvs) { log_error("Can't report LV and PV fields at the same time"); dm_report_free(report_handle); - return 0; + return ECMD_FAILED; } /* Change report type if fields specified makes this necessary */