Blame SOURCES/0004-tools-remove-errx-from-adcli_read_password_func.patch

341f9a
From 251d7d0c71226afb8e51f7bc5794a7a3164f5a20 Mon Sep 17 00:00:00 2001
341f9a
From: Sumit Bose <sbose@redhat.com>
341f9a
Date: Mon, 15 Apr 2019 17:59:17 +0200
341f9a
Subject: [PATCH 4/7] tools: remove errx from adcli_read_password_func
341f9a
341f9a
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1588596
341f9a
---
341f9a
 tools/tools.c | 11 ++++++++---
341f9a
 1 file changed, 8 insertions(+), 3 deletions(-)
341f9a
341f9a
diff --git a/tools/tools.c b/tools/tools.c
341f9a
index c4e2851..bdf6d38 100644
341f9a
--- a/tools/tools.c
341f9a
+++ b/tools/tools.c
341f9a
@@ -247,7 +247,9 @@ adcli_read_password_func (adcli_login_type login_type,
341f9a
 		if (res < 0) {
341f9a
 			if (errno == EAGAIN || errno == EINTR)
341f9a
 				continue;
341f9a
-			err (EFAIL, "couldn't read password from stdin");
341f9a
+			warn ("couldn't read password from stdin");
341f9a
+			free (buffer);
341f9a
+			return NULL;
341f9a
 
341f9a
 		} else if (res == 0) {
341f9a
 			buffer[offset] = '\0';
341f9a
@@ -261,8 +263,11 @@ adcli_read_password_func (adcli_login_type login_type,
341f9a
 			return buffer;
341f9a
 
341f9a
 		} else {
341f9a
-			if (memchr (buffer + offset, 0, res))
341f9a
-				errx (EUSAGE, "unsupported null character present in password");
341f9a
+			if (memchr (buffer + offset, 0, res)) {
341f9a
+				warnx ("unsupported null character present in password");
341f9a
+				free (buffer);
341f9a
+				return NULL;
341f9a
+			}
341f9a
 			offset += res;
341f9a
 		}
341f9a
 	}
341f9a
-- 
341f9a
2.20.1
341f9a