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

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