File 0012-nvme-cli-return-0-if-disconnect-operation-with-cfg.nqn.patch of Package nvme-cli.10193

From 0b90b67ff017f8ae3e5246687aa91008c689d21e Mon Sep 17 00:00:00 2001
From: Yi Zhang <yizhan@redhat.com>
Date: Tue, 18 Apr 2017 17:20:24 +0800
Subject: nvme-cli: return 0 if disconnect operation with cfg.nqn successfully

Git-commit: f4806f68a54f664b533d3a269d19b400e136d04d
References: bsc#1076417

disconnect_by_nqn function will return the number of controllers
successfully disconnected, so change ret = 0 if disconnect operation
with nqn successfully.

$ ./nvme disconnect -n testnqn
NQN:testnqn disconnected 1 controller(s)
$ echo $?
1

Signed-off-by: Yi Zhang <yizhan@redhat.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 fabrics.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fabrics.c b/fabrics.c
index 7cf5f46..d474a2a 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -1003,8 +1003,10 @@ int disconnect(const char *desc, int argc, char **argv)
 		if (ret < 0)
 			fprintf(stderr, "Failed to disconnect by NQN: %s\n",
 				cfg.nqn);
-		else
+		else {
 			printf("NQN:%s disconnected %d controller(s)\n", cfg.nqn, ret);
+			ret = 0;
+		}
 	}
 
 	if (cfg.device) {
-- 
2.13.7

openSUSE Build Service is sponsored by