[augeas-devel] [PATCH] Fix enable span not working

Francis Giraldeau francis.giraldeau at gmail.com
Thu Oct 6 12:52:35 UTC 2011


Span information was collected when the option is set, but the command would
fail. The test to determine if span is enable was not working properly. It was
testing against a NULL string. Instead, use the option flag from the aug tree,
since this value really reflects the state of span information in the tree
after an effective load.

Fix ticket #220
---
 src/augrun.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/src/augrun.c b/src/augrun.c
index 636b6fe..f4a4e03 100644
--- a/src/augrun.c
+++ b/src/augrun.c
@@ -619,19 +619,13 @@ static void cmd_span(struct command *cmd) {
     int r;
     uint label_start, label_end, value_start, value_end, span_start, span_end;
     char *filename = NULL;
-    const char *option = NULL;
 
-    if (! streqv(AUG_DISABLE, option)) {
+    if (!(cmd->aug->flags & AUG_ENABLE_SPAN)) {
         ERR_REPORT(cmd, AUG_ECMDRUN,
                    "Span is not enabled. To enable, run the commands:\n"
                    "    set %s %s\n    rm %s\n    load\n",
                    AUGEAS_SPAN_OPTION, AUG_ENABLE, AUGEAS_FILES_TREE);
         return;
-    } else if (streqv(AUG_ENABLE, option)) {
-        ERR_REPORT(cmd, AUG_ECMDRUN,
-                   "option %s must be %s or %s\n", AUGEAS_SPAN_OPTION,
-                   AUG_ENABLE, AUG_DISABLE);
-        return;
     }
     r = aug_span(cmd->aug, path, &filename, &label_start, &label_end,
                  &value_start, &value_end, &span_start, &span_end);
-- 
1.7.4.1




More information about the augeas-devel mailing list