]> granicus.if.org Git - sudo/commitdiff
Fix indentation of Defaults entries. The initial indent should be
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 12 Feb 2014 22:00:04 +0000 (15:00 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 12 Feb 2014 22:00:04 +0000 (15:00 -0700)
outside the loop iterating over the entries.

plugins/sudoers/visudo_json.c

index 2cf9c5556ca3da14ec1610216d1ba7ca44ee381a..0598b31f5b9f6c481138ae0b6b41760817cb4668 100644 (file)
@@ -603,6 +603,7 @@ print_defaults_json(FILE *fp, int indent, bool need_comma)
        debug_return_bool(need_comma);
 
     fprintf(fp, "%s\n%*s\"Defaults\": [\n", need_comma ? "," : "", indent, "");
+    indent += 4;
 
     TAILQ_FOREACH_SAFE(def, &defaults, entries, next) {
        type = get_defaults_type(def);
@@ -613,7 +614,6 @@ print_defaults_json(FILE *fp, int indent, bool need_comma)
        }
 
        /* Found it, print object container and binding (if any). */
-       indent += 4;
        fprintf(fp, "%*s{\n", indent, "");
        indent += 4;
        print_binding_json(fp, def->binding, def->type, indent);