]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
fabrics: do not print 'unrecognized' address family for loop
authorHannes Reinecke <hare@suse.de>
Tue, 23 Nov 2021 07:19:20 +0000 (08:19 +0100)
committerHannes Reinecke <hare@suse.de>
Tue, 23 Nov 2021 07:19:20 +0000 (08:19 +0100)
fabrics implementations like 'loop' do not have a transport address,
and consequently the address family value doesn't make any sense here.
So do not try to translate the address family to a printable string
if the address itself is empty.

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

index e08ed494d5e77a6f13c262406a4e758d49c5f252..176b5093eab4b4269322936ee2b12b18fb5ca654 100644 (file)
--- a/fabrics.c
+++ b/fabrics.c
@@ -130,7 +130,9 @@ static void print_discovery_log(struct nvmf_discovery_log *log, int numrec)
 
                printf("=====Discovery Log Entry %d======\n", i);
                printf("trtype:  %s\n", nvmf_trtype_str(e->trtype));
-               printf("adrfam:  %s\n", nvmf_adrfam_str(e->adrfam));
+               printf("adrfam:  %s\n",
+                       e->traddr && strlen(e->traddr) ?
+                       nvmf_adrfam_str(e->adrfam): "");
                printf("subtype: %s\n", nvmf_subtype_str(e->subtype));
                printf("treq:    %s\n", nvmf_treq_str(e->treq));
                printf("portid:  %d\n", e->portid);