[augeas-devel] [PATCH 01/16] struct error: add pointer back to struct augeas

lutter at redhat.com lutter at redhat.com
Wed Dec 23 21:30:50 UTC 2009


From: David Lutterkort <lutter at redhat.com>

---
 src/augeas.c  |    2 ++
 src/errcode.h |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/augeas.c b/src/augeas.c
index 59d3743..a771b79 100644
--- a/src/augeas.c
+++ b/src/augeas.c
@@ -297,6 +297,8 @@ struct augeas *aug_init(const char *root, const char *loadpath,
         goto error;
     if (ALLOC(result->error) < 0)
         goto error;
+    result->error->aug = result;
+
     result->origin = make_tree_origin(tree_root);
     if (result->origin == NULL) {
         free_tree(tree_root);
diff --git a/src/errcode.h b/src/errcode.h
index e5d2334..a39f785 100644
--- a/src/errcode.h
+++ b/src/errcode.h
@@ -35,6 +35,11 @@ struct error {
     int            minor;
     char          *details;       /* Human readable explanation */
     const char    *minor_details; /* Human readable version of MINOR */
+    /* Bit of a kludge to get at struct augeas, but since struct error
+     * is now available in a lot of places (through struct info), this
+     * gives a convenient way to get at the overall state
+     */
+    const struct augeas *aug;
 };
 
 void report_error(struct error *err, aug_errcode_t errcode,
-- 
1.6.5.2




More information about the augeas-devel mailing list