File 0008-Correctly-ignore-invalid-VPD-entries.patch of Package sg3_utils.1394

From 91a896587db4ea363d5fd873c2429b61dd11cc3f Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 25 Nov 2014 12:42:54 +0100
Subject: [PATCH] Correctly ignore invalid VPD entries

The patch 'Fixup formatting of invalid VPD page 0x83' is incorrect
as it would display an error even for valid SCSI name strings.

References: bnc#907049

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 src/sg_inq.c | 4 ++--
 src/sg_vpd.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/sg_inq.c b/src/sg_inq.c
index 74b11ff..043a4cc 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -1967,8 +1967,8 @@ export_dev_ids(unsigned char * buff, int len, int verbose)
                 }
                 break;
             }
-            if (strncmp((const char *)ip, "eui.", 4) ||
-                strncmp((const char *)ip, "naa.", 4) ||
+            if (strncmp((const char *)ip, "eui.", 4) &&
+                strncmp((const char *)ip, "naa.", 4) &&
                 strncmp((const char *)ip, "iqn.", 4)) {
                 if (verbose) {
                     pr2serr("      << expected name string prefix>>\n");
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index a8879e2..dc78c23 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -1108,8 +1108,8 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
                 dStrHexErr((const char *)ip, i_len, 0);
                 break;
             }
-            if (strncmp((const char *)ip, "eui.", 4) ||
-                strncmp((const char *)ip, "naa.", 4) ||
+            if (strncmp((const char *)ip, "eui.", 4) &&
+                strncmp((const char *)ip, "naa.", 4) &&
                 strncmp((const char *)ip, "iqn.", 4)) {
                 pr2serr("      << expected name string prefix>>\n");
                 dStrHexErr((const char *)ip, i_len, -1);
-- 
1.8.5.2

openSUSE Build Service is sponsored by