public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme-cli: netapp plugin handle empty strings
@ 2018-08-23 19:33 Schremmer, Steven
  2018-08-23 19:56 ` Keith Busch
  0 siblings, 1 reply; 2+ messages in thread
From: Schremmer, Steven @ 2018-08-23 19:33 UTC (permalink / raw)


Handle controller fields with strings of length 0.

Signed-off-by: Steve Schremmer <steve.schremmer at netapp.com>
---
 netapp-nvme.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/netapp-nvme.c b/netapp-nvme.c
index 1167db4..b369913 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)
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-23 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-23 19:33 [PATCH] nvme-cli: netapp plugin handle empty strings Schremmer, Steven
2018-08-23 19:56 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox