]> granicus.if.org Git - sudo/commitdiff
Better prefix determination now that we can't rely on len==0 to
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 19 Mar 2010 12:17:58 +0000 (08:17 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 19 Mar 2010 12:17:58 +0000 (08:17 -0400)
tell the beginning on an entry.

plugins/sudoers/parse.c

index 3dfe7b84630080ca0780e3e3f90b77344d975719..f7ea49e4c15ee979e773970970f1f149851bc374 100644 (file)
@@ -445,13 +445,17 @@ sudo_file_display_defaults(nss, pw, lbuf)
     struct lbuf *lbuf;
 {
     struct defaults *d;
-    char *prefix = NULL;
+    char *prefix;
     int nfound = 0;
 
     if (nss->handle == NULL)
        return(-1);
 
-    prefix = "    ";
+    if (lbuf->len == 0 || isspace((unsigned char)lbuf->buf[lbuf->len - 1]))
+       prefix = "    ";
+    else
+       prefix = ", ";
+
     tq_foreach_fwd(&defaults, d) {
        switch (d->type) {
            case DEFAULTS_HOST: