From a9809488354a88fa728bba34471670b7aee47be8 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 27 Apr 2007 15:22:27 +0000 Subject: [PATCH] Avoid trailing separator in reports when there are hidden sort fields. --- WHATS_NEW | 1 + lib/libdm-report.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index 3df6981..f6eac97 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 1.02.19 - ==================================== + Avoid trailing separator in reports when there are hidden sort fields. Fix segfault in 'dmsetup status' without --showkeys against crypt target. Deal with some more compiler warnings. Introduce _add_field() and _is_same_field() to libdm-report.c. diff --git a/lib/libdm-report.c b/lib/libdm-report.c index 1423872..1bff838 100644 --- a/lib/libdm-report.c +++ b/lib/libdm-report.c @@ -316,7 +316,15 @@ static struct field_properties * _add_field(struct dm_report *rh, } fp->flags |= flags; - list_add(&rh->field_props, &fp->list); + + /* + * Place hidden fields at the front so list_end() will + * tell us when we've reached the last visible field. + */ + if (fp->flags & FLD_HIDDEN) + list_add_h(&rh->field_props, &fp->list); + else + list_add(&rh->field_props, &fp->list); return fp; } -- 2.43.5