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

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