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

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