File 0007-nvme-cli-fix-connecting-failure-due-to-invalid-uuid-format.patch of Package nvme-cli.10193

From a5997fe5eae833e390c5a1a83501a195d1bcee0b Mon Sep 17 00:00:00 2001
From: Guan Junxiong <guanjunxiong@huawei.com>
Date: Thu, 3 Aug 2017 21:38:16 +0800
Subject: nvme-cli: fix connecting failure due to invalid uuid format of hostid

Git-commit: 0832d06cd62d3541489a3b74e6280b6b68522880

When we connect or discover a target with --hostid option via the
/etc/nvme/hostid file, we fails this operation because the hostid
is only 35 not 36 bytes which doesn't pass the uuid checking in the
kernel.The last character is overridden with null bytes because fgets
reads at most one less than sizeof of buffer characters.

Signed-off-by: Guan Junxiong <guanjunxiong@huawei.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 fabrics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fabrics.c b/fabrics.c
index 9d94cf8..f6f28d0 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -458,7 +458,7 @@ out:
 static int nvmf_hostid_file(void)
 {
 	FILE *f;
-	char hostid[NVMF_HOSTID_SIZE];
+	char hostid[NVMF_HOSTID_SIZE + 1];
 	int ret = false;
 
 	f = fopen(PATH_NVMF_HOSTID, "r");
-- 
2.13.7

openSUSE Build Service is sponsored by