[augeas-devel] [PATCH 2/8] * src/syntax.c (interpreter_init): report errors

David Lutterkort lutter at redhat.com
Tue Sep 22 00:48:59 UTC 2009


---
 src/syntax.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/syntax.c b/src/syntax.c
index fd8b472..014bfb6 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1943,11 +1943,18 @@ int interpreter_init(struct augeas *aug) {
     while ((dir = argz_next(aug->modpathz, aug->nmodpath, dir)) != NULL) {
         char *globpat;
         r = asprintf(&globpat, "%s/*.aug", dir);
-        if (r == -1)
-            return -1;
+        ERR_NOMEM(r < 0, aug);
+
         r = glob(globpat, gl_flags, NULL, &globbuf);
-        if (r != 0 && r != GLOB_NOMATCH)
-            FIXME("glob failure for %s", globpat);
+        if (r != 0 && r != GLOB_NOMATCH) {
+            /* This really has to be an allocation failure; glob is not
+             * supposed to return GLOB_ABORTED here */
+            aug_errcode_t code =
+                r == GLOB_NOSPACE ? AUG_ENOMEM : AUG_EINTERNAL;
+            ERR_REPORT(aug, code, "glob failure for %s", globpat);
+            free(globpat);
+            goto error;
+        }
         gl_flags |= GLOB_APPEND;
         free(globpat);
     }
-- 
1.6.2.5




More information about the augeas-devel mailing list