summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-08-12 22:02:23 +0100
committerBryn M. Reeves <bmr@redhat.com>2015-08-12 22:02:23 +0100
commit7995eedd3581407b030b0864202068b51dd1ef45 (patch)
treeabd8e9c2e0472aa1beeb8dfc1412e47d9fb8f75c
parent098528513f8c00d12f4ca5b5e87e4a932a6ef4f6 (diff)
downloadlvm2-7995eedd3581407b030b0864202068b51dd1ef45.tar.gz
dmstats: don't output column headings if report fails
If _stats_report fails (e.g. due to an invalid device on the command line) destroy the _report to prevent stats columns headings from being displayed. This also requires a change in main to test the return from _perform_command_for_all_repeatable_args inside the interval loop and exit immediately in case of error.
-rw-r--r--tools/dmsetup.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index e913a7edf..dd2f1539f 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -4692,6 +4692,10 @@ static int _stats_report(CMD_ARGS)
out:
dm_task_destroy(dmt);
+ if (!r && _report) {
+ dm_report_free(_report);
+ _report = NULL;
+ }
return r;
}
@@ -5838,6 +5842,9 @@ doit:
goto_out;
}
}
+
+ if (r)
+ break;
} while (--_count);
out: