Skip to content

Commit 68ffc10

Browse files
committed
display_privs: Don't line wrap if output is not a tty
Previously we just checked whether the output was a pipe. However, that doesn't catch the output being redirected to a file or shells like ksh93 which use a socketpair instead of a pipe.
1 parent bcbaca6 commit 68ffc10

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

plugins/sudoers/display.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ display_privs(struct sudoers_context *ctx, const struct sudo_nss_list *snl,
459459
}
460460

461461
cols = ctx->user.cols;
462-
if (fstat(STDOUT_FILENO, &sb) == 0 && S_ISFIFO(sb.st_mode))
462+
if (!sudo_isatty(STDOUT_FILENO, &sb))
463463
cols = 0;
464464
sudo_lbuf_init(&def_buf, output, 4, NULL, cols);
465465
sudo_lbuf_init(&priv_buf, output, 8, NULL, cols);

0 commit comments

Comments
 (0)