]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: make 'disconnect' accepting only -n or -d
authorHannes Reinecke <hare@suse.de>
Mon, 27 Jan 2025 11:20:46 +0000 (12:20 +0100)
committerDaniel Wagner <wagi@monom.org>
Tue, 28 Jan 2025 07:31:19 +0000 (08:31 +0100)
There is limited usability in specifying both -n and -d, so make
both exclusive.

Signed-off-by: Hannes Reinecke <hare@suse.de>
fabrics.c

index 9dfb14bfcf8b34dbccd421830bf57f5180aacb9d..ab17e179c47698ac9aafb11fc96419558f139842 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -1189,6 +1189,11 @@ int nvmf_disconnect(const char *desc, int argc, char **argv)
        if (ret)
                return ret;
 
+       if (cfg.nqn && cfg.device) {
+               fprintf(stderr,
+                       "Both device name [--device | -d] and NQN [--nqn | -n] are specified\n");
+               return -EINVAL;
+       }
        if (!cfg.nqn && !cfg.device) {
                fprintf(stderr,
                        "Neither device name [--device | -d] nor NQN [--nqn | -n] provided\n");