From af998ff6c2aa0c125293e3766208407dda9bb855 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_DM | 1 + libdm/libdm-report.c | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 3df698147..f6eac9711 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -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/libdm/libdm-report.c b/libdm/libdm-report.c index 1423872ca..1bff83856 100644 --- a/libdm/libdm-report.c +++ b/libdm/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; }