]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: return 0 if disconnect operation with cfg.nqn successfully
authorYi Zhang <yizhan@redhat.com>
Tue, 18 Apr 2017 09:20:24 +0000 (17:20 +0800)
committerKeith Busch <keith.busch@intel.com>
Tue, 18 Apr 2017 13:20:03 +0000 (09:20 -0400)
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

index cd671c7aa4e0f5300e94220ceb9b78af24858056..a2e8f602ed9abee178ebf53c49ce16ce44a820b2 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -934,8 +934,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) {