Blob Blame History Raw
From 40c4319fd3100dcbf97880508c869978dff8f818 Mon Sep 17 00:00:00 2001
From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Date: Thu, 20 Sep 2018 07:37:01 +0200
Subject: [PATCH] iscsiuio: fail on nic_nl_open failing

The return value of nic_nl_open was ignored and while working by chance
being the latest call before the error label any later insertion of code
after this might break it.

Avoid that by checking for the retval and explicitly jumping to the
error label in case it is non zero.

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

diff --git a/iscsiuio/src/unix/main.c b/iscsiuio/src/unix/main.c
index 5cccc76ed220..552c96a36e86 100644
--- a/iscsiuio/src/unix/main.c
+++ b/iscsiuio/src/unix/main.c
@@ -393,7 +393,8 @@ int main(int argc, char *argv[])
 		goto error;
 
 	/*  NetLink connection to listen to NETLINK_ISCSI private messages */
-	nic_nl_open();
+	if (nic_nl_open() != 0)
+		goto error;
 
 error:
 	cleanup();
-- 
2.17.2