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