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

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