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

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