sudo_lbuf_print: no longer need to check for lbuf->len > 0.

Now that lbuf length is unsigned the earlier check for len == 0 is
sufficient.
This commit is contained in:
Todd C. Miller
2023-01-09 14:16:59 -07:00
parent ca297658dd
commit 1b7604e5cb

View File

@@ -288,12 +288,10 @@ sudo_lbuf_print_v1(struct sudo_lbuf *lbuf)
/* For very small widths just give up... */
len = lbuf->continuation ? strlen(lbuf->continuation) : 0;
if (lbuf->cols <= lbuf->indent + len + 20) {
if (lbuf->len > 0) {
lbuf->buf[lbuf->len] = '\0';
lbuf->output(lbuf->buf);
if (lbuf->buf[lbuf->len - 1] != '\n')
lbuf->output("\n");
}
lbuf->buf[lbuf->len] = '\0';
lbuf->output(lbuf->buf);
if (lbuf->buf[lbuf->len - 1] != '\n')
lbuf->output("\n");
goto done;
}