diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-05-31 09:08:59 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-05-31 09:08:59 +0200 |
commit | 4fb224a5532defa08d48b28add98606803035b9d (patch) | |
tree | 53acf9332dbf34912cdf5d57730191c7e629c6a0 | |
parent | e4ec6bcdd38505c6c229d578aa3eca006441b035 (diff) | |
download | lvm2-4fb224a5532defa08d48b28add98606803035b9d.tar.gz |
toollib: properly reset selection handle on selection failure in select_match_{pv,vg,lv}
-rw-r--r-- | tools/toollib.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tools/toollib.c b/tools/toollib.c index b86b8ffd5..b41db0f92 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1766,49 +1766,49 @@ void destroy_processing_handle(struct cmd_context *cmd, struct processing_handle int select_match_vg(struct cmd_context *cmd, struct processing_handle *handle, struct volume_group *vg) { + int r; + if (!handle->internal_report_for_select) return 1; handle->selection_handle->orig_report_type = VGS; - if (!report_for_selection(cmd, handle, NULL, vg, NULL)) { + if (!(r = report_for_selection(cmd, handle, NULL, vg, NULL))) log_error("Selection failed for VG %s.", vg->name); - return 0; - } handle->selection_handle->orig_report_type = 0; - return 1; + return r; } int select_match_lv(struct cmd_context *cmd, struct processing_handle *handle, struct volume_group *vg, struct logical_volume *lv) { + int r; + if (!handle->internal_report_for_select) return 1; handle->selection_handle->orig_report_type = LVS; - if (!report_for_selection(cmd, handle, NULL, vg, lv)) { + if (!(r = report_for_selection(cmd, handle, NULL, vg, lv))) log_error("Selection failed for LV %s.", lv->name); - return 0; - } handle->selection_handle->orig_report_type = 0; - return 1; + return r; } int select_match_pv(struct cmd_context *cmd, struct processing_handle *handle, struct volume_group *vg, struct physical_volume *pv) { + int r; + if (!handle->internal_report_for_select) return 1; handle->selection_handle->orig_report_type = PVS; - if (!report_for_selection(cmd, handle, pv, vg, NULL)) { + if (!(r = report_for_selection(cmd, handle, pv, vg, NULL))) log_error("Selection failed for PV %s.", dev_name(pv->dev)); - return 0; - } handle->selection_handle->orig_report_type = 0; - return 1; + return r; } static int _select_matches(struct processing_handle *handle) |