From: Schremmer, Steven Date: Thu, 23 Aug 2018 19:33:12 +0000 (+0000) Subject: nvme-cli: netapp plugin handle empty strings X-Git-Tag: v1.7~87 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8e78d3c74516c3f4e1a886aaeb652ae4484f79fe;p=users%2Fsagi%2Fnvme-cli.git nvme-cli: netapp plugin handle empty strings Handle controller fields with strings of length 0. Signed-off-by: Steve Schremmer --- diff --git a/netapp-nvme.c b/netapp-nvme.c index 1167db49..542d35dc 100644 --- a/netapp-nvme.c +++ b/netapp-nvme.c @@ -63,6 +63,9 @@ static void netapp_convert_string(char *dst, char *src, unsigned int count) memset(dst, 0, count + 1); for (i = 0; i < count; i++) dst[i] = src[i * 2 + 1]; + /* the json routines won't accept empty strings */ + if (strlen(dst) == 0 && count) + dst[0] = ' '; } static void netapp_nguid_to_str(char *str, __u8 *nguid)