From: Zdenek Kabelac Date: Wed, 5 Jan 2011 12:33:51 +0000 (+0000) Subject: Return PERCENT_INVALID for error case X-Git-Tag: v2_02_91~1227 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=1936d75b3c0b5a1788919ba521ef73468cf78735;p=lvm2.git Return PERCENT_INVALID for error case If the percent value could not be determined return PERCENT_INVALID. Indent function with tabs. --- diff --git a/WHATS_NEW b/WHATS_NEW index c2f9dfbaa..562627c51 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.80 - ==================================== + Return defined value for errors in _copy_percent() and _snap_percent(). Correct return code of cmirrord when issuing 'start' when already running. Fix wrongly paired unlocking of global lock in pvchange. (2.02.66) Add backtraces for backup and backup_remove fail paths. diff --git a/lib/report/properties.c b/lib/report/properties.c index 0b4929aa6..06e11ba92 100644 --- a/lib/report/properties.c +++ b/lib/report/properties.c @@ -87,15 +87,18 @@ static int _not_implemented_set(void *obj, struct lvm_property_type *prop) } static percent_t _copy_percent(const struct logical_volume *lv) { - percent_t perc; - lv_mirror_percent(lv->vg->cmd, (struct logical_volume *) lv, 0, &perc, NULL); - return perc; + percent_t perc; + if (!lv_mirror_percent(lv->vg->cmd, (struct logical_volume *) lv, + 0, &perc, NULL)) + perc = PERCENT_INVALID; + return perc; } static percent_t _snap_percent(const struct logical_volume *lv) { - percent_t perc; - lv_snapshot_percent(lv, &perc); - return perc; + percent_t perc; + if (!lv_snapshot_percent(lv, &perc)) + perc = PERCENT_INVALID; + return perc; } /* PV */