Blame 0003-tools-remove-errx-from-info-commands.patch

603fc1b
From 4794812cc98c8783921f534d20dae8b44f3826d2 Mon Sep 17 00:00:00 2001
603fc1b
From: Sumit Bose <sbose@redhat.com>
603fc1b
Date: Mon, 15 Apr 2019 17:57:37 +0200
603fc1b
Subject: [PATCH 3/7] tools: remove errx from info commands
603fc1b
603fc1b
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1588596
603fc1b
---
603fc1b
 tools/info.c | 21 ++++++++++++++-------
603fc1b
 1 file changed, 14 insertions(+), 7 deletions(-)
603fc1b
603fc1b
diff --git a/tools/info.c b/tools/info.c
603fc1b
index e7e20ad..c63e0ff 100644
603fc1b
--- a/tools/info.c
603fc1b
+++ b/tools/info.c
603fc1b
@@ -162,21 +162,28 @@ adcli_tool_info (adcli_conn *unused,
603fc1b
 
603fc1b
 	if (argc == 1)
603fc1b
 		domain = argv[0];
603fc1b
-	else if (argc != 0)
603fc1b
-		errx (2, "specify one user name to create");
603fc1b
+	else if (argc != 0) {
603fc1b
+		warnx ("specify one user name to create");
603fc1b
+		return 2;
603fc1b
+	}
603fc1b
 
603fc1b
 	if (server) {
603fc1b
 		adcli_disco_host (server, &disco);
603fc1b
-		if (disco == NULL)
603fc1b
-			errx (1, "couldn't discover domain controller: %s", server);
603fc1b
+		if (disco == NULL) {
603fc1b
+			warnx ("couldn't discover domain controller: %s", server);
603fc1b
+			return 1;
603fc1b
+		}
603fc1b
 		for_host = 1;
603fc1b
 	} else if (domain) {
603fc1b
 		adcli_disco_domain (domain, &disco);
603fc1b
-		if (disco == NULL)
603fc1b
-			errx (1, "couldn't discover domain: %s", domain);
603fc1b
+		if (disco == NULL) {
603fc1b
+			warnx ("couldn't discover domain: %s", domain);
603fc1b
+			return 1;
603fc1b
+		}
603fc1b
 		for_host = 0;
603fc1b
 	} else {
603fc1b
-		errx (2, "specify a domain to discover");
603fc1b
+		warnx ("specify a domain to discover");
603fc1b
+		return 2;
603fc1b
 	}
603fc1b
 
603fc1b
 	print_info (disco, for_host);
603fc1b
-- 
603fc1b
2.20.1
603fc1b