Blame SOURCES/0028-daemon-augeas-Enhance-error-reporting-for-aug_init-f.patch

022f11
From 9eb1b906eb978a46826a5eaeacb0fd29a81250ca Mon Sep 17 00:00:00 2001
022f11
From: "Richard W.M. Jones" <rjones@redhat.com>
022f11
Date: Mon, 2 Sep 2013 19:19:26 +0100
022f11
Subject: [PATCH] daemon: augeas: Enhance error reporting for aug_init
022f11
 failures.
022f11
022f11
Thanks: Dominic Cleal.
022f11
(cherry picked from commit 3d132f29204e8c5c77f08841b5288dfe3013f4f0)
022f11
---
022f11
 daemon/augeas.c | 16 +++++++++++++++-
022f11
 1 file changed, 15 insertions(+), 1 deletion(-)
022f11
022f11
diff --git a/daemon/augeas.c b/daemon/augeas.c
022f11
index 83e2739..9d6a553 100644
022f11
--- a/daemon/augeas.c
022f11
+++ b/daemon/augeas.c
022f11
@@ -98,12 +98,26 @@ do_aug_init (const char *root, int flags)
022f11
     return -1;
022f11
   }
022f11
 
022f11
+#ifdef AUG_NO_ERR_CLOSE
022f11
+  /* Pass AUG_NO_ERR_CLOSE so we can display detailed errors. */
022f11
+  aug = aug_init (buf, NULL, flags | AUG_NO_ERR_CLOSE);
022f11
+#else
022f11
   aug = aug_init (buf, NULL, flags);
022f11
+#endif
022f11
 
022f11
   if (!aug) {
022f11
-    reply_with_error ("Augeas initialization failed");
022f11
+    reply_with_error ("augeas initialization failed");
022f11
+    return -1;
022f11
+  }
022f11
+
022f11
+#ifdef AUG_NO_ERR_CLOSE
022f11
+  if (aug_error (aug) != AUG_NOERROR) {
022f11
+    AUGEAS_ERROR ("aug_init: %s (flags %d)", root, flags);
022f11
+    aug_close (aug);
022f11
+    aug = NULL;
022f11
     return -1;
022f11
   }
022f11
+#endif
022f11
 
022f11
   return 0;
022f11
 }
022f11
-- 
022f11
1.8.3.1
022f11