master - dmstats: don't output column headings if report fails
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7995eedd3581407b030b0864202068b51dd1ef45 Commit: 7995eedd3581407b030b0864202068b51dd1ef45 Parent: 098528513f8c00d12f4ca5b5e87e4a932a6ef4f6 Author: Bryn M. Reeves <[email protected]> AuthorDate: Wed Aug 12 22:02:23 2015 +0100 Committer: Bryn M. Reeves <[email protected]> CommitterDate: Wed Aug 12 22:02:23 2015 +0100
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.
--- tools/dmsetup.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
tools/dmsetup.c +7 -0
@@ -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: