[lvm-devel] [PATCH 1/4] report: Print NULL strings as "" in _string_disp (instead of a SEGV).

Petr Rockai prockai at redhat.com
Mon Dec 15 22:32:37 UTC 2014


---
 lib/report/report.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/report/report.c b/lib/report/report.c
index 5637d50..043de88 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -179,6 +179,8 @@ static int _string_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
 			struct dm_report_field *field,
 			const void *data, void *private __attribute__((unused)))
 {
+	if (!*(void**) data)
+		return _field_set_value(field, "", NULL);
 	return dm_report_field_string(rh, field, (const char * const *) data);
 }
 
-- 
2.1.2




More information about the lvm-devel mailing list