Blame SOURCES/0001-build-add-with-vendor-error-message-configure-option.patch

69a8fd
From 0353d704879f20983184f8bded4f16538d72f7cc Mon Sep 17 00:00:00 2001
69a8fd
From: Sumit Bose <sbose@redhat.com>
69a8fd
Date: Wed, 10 Mar 2021 18:12:09 +0100
69a8fd
Subject: [PATCH] build: add --with-vendor-error-message configure option
69a8fd
69a8fd
With the new configure option --with-vendor-error-message a packager or
69a8fd
a distribution can add a message if adcli returns with an error.
69a8fd
69a8fd
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1889386
69a8fd
---
69a8fd
 configure.ac  | 15 +++++++++++++++
69a8fd
 tools/tools.c |  6 ++++++
69a8fd
 2 files changed, 21 insertions(+)
69a8fd
69a8fd
diff --git a/configure.ac b/configure.ac
69a8fd
index baa0d3b..7dfba97 100644
69a8fd
--- a/configure.ac
69a8fd
+++ b/configure.ac
69a8fd
@@ -123,6 +123,21 @@ if test "$sasl_invalid" = "yes"; then
69a8fd
 	AC_MSG_ERROR([Couldn't find Cyrus SASL headers])
69a8fd
 fi
69a8fd
 
69a8fd
+# --------------------------------------------------------------------
69a8fd
+# Vendor error message
69a8fd
+
69a8fd
+AC_ARG_WITH([vendor-error-message],
69a8fd
+              [AS_HELP_STRING([--with-vendor-error-message=ARG],
69a8fd
+                            [Add a vendor specific error message shown if a adcli command fails]
69a8fd
+                           )],
69a8fd
+              [AS_IF([test "x$withval" != "x"],
69a8fd
+                     [AC_DEFINE_UNQUOTED([VENDOR_MSG],
69a8fd
+                                         ["$withval"],
69a8fd
+                                         [Vendor specific error message])],
69a8fd
+                     [AC_MSG_ERROR([--with-vendor-error-message requires an argument])]
69a8fd
+                    )],
69a8fd
+              [])
69a8fd
+
69a8fd
 # --------------------------------------------------------------------
69a8fd
 # Documentation options
69a8fd
 
69a8fd
diff --git a/tools/tools.c b/tools/tools.c
69a8fd
index d0dcf98..84bbba9 100644
69a8fd
--- a/tools/tools.c
69a8fd
+++ b/tools/tools.c
69a8fd
@@ -538,6 +538,12 @@ main (int argc,
69a8fd
 
69a8fd
 		if (conn)
69a8fd
 			adcli_conn_unref (conn);
69a8fd
+#ifdef VENDOR_MSG
69a8fd
+		if (ret != 0) {
69a8fd
+			fprintf (stderr, VENDOR_MSG"\n");
69a8fd
+		}
69a8fd
+#endif
69a8fd
+
69a8fd
 		return ret;
69a8fd
 	}
69a8fd
 
69a8fd
-- 
69a8fd
2.30.2
69a8fd