]> granicus.if.org Git - sudo/commitdiff
When expanding an alias in print_member_json_int() avoid printing
authorTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 20 Sep 2018 20:56:25 +0000 (14:56 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 20 Sep 2018 20:56:25 +0000 (14:56 -0600)
an extra comma at the end of the entry.  Bug #853.

plugins/sudoers/cvtsudoers_json.c

index 9490579fc6fe98ffc79f9189a052fb8c45932142..901f2b104df14c602ec8d499a0e07f7f03929554 100644 (file)
@@ -500,10 +500,11 @@ print_member_json_int(FILE *fp, struct sudoers_parse_tree *parse_tree,
     } else {
        print_pair_json(fp, "{ ", typestr, &value, " }", indent);
     }
-    if (!last_one)
-       putc(',', fp);
-    if (need_newline)
+    if (need_newline) {
+       if (!last_one)
+           putc(',', fp);
        putc('\n', fp);
+    }
 
     debug_return;
 }