Blob Blame History Raw
From 67d24cb06da6f9bc14dc5d9b833fad0e9ca1982f Mon Sep 17 00:00:00 2001
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Date: Thu, 20 Sep 2018 07:34:30 +0200
Subject: [PATCH] iscsiuio: avoid loosing bad rc in nic_nl_open

nic_nl_open might have collected a non-zero rc and jumped to the error
label but still returned zero which would indicate success.

The function should return whatever it has collected in rc and while
working without, also explicitly initialize it to zero.

Fixes #125

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 iscsiuio/src/unix/nic_nl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/iscsiuio/src/unix/nic_nl.c b/iscsiuio/src/unix/nic_nl.c
index 1a920c7b63fe..658843236da8 100644
--- a/iscsiuio/src/unix/nic_nl.c
+++ b/iscsiuio/src/unix/nic_nl.c
@@ -534,7 +534,7 @@ static void flush_nic_nl_process_ring(nic_t *nic)
  */
 int nic_nl_open()
 {
-	int rc;
+	int rc = 0;
 	char *msg_type_str;
 
 	/* Prepare the thread to issue the ARP's */
@@ -676,5 +676,5 @@ int nic_nl_open()
 	rc = 0;
 
 error:
-	return 0;
+	return rc;
 }
-- 
2.17.2