Add an fd argument to sudo_get_ttysize() instead of always using stderr.

For sudoreplay we open /dev/tty, so use that instead of stderr when
determining the terminal size.
This commit is contained in:
Todd C. Miller
2023-04-16 15:45:19 -06:00
parent 5650b436e6
commit cc22cca34f
6 changed files with 18 additions and 10 deletions

View File

@@ -755,7 +755,7 @@ usage(void)
{
int rows, cols;
sudo_get_ttysize(&rows, &cols);
sudo_get_ttysize(STDERR_FILENO, &rows, &cols);
display_usage(usage_err, cols);
exit(EXIT_FAILURE);
}
@@ -796,7 +796,7 @@ help(void)
int rows, cols;
debug_decl(help, SUDO_DEBUG_ARGS);
sudo_get_ttysize(&rows, &cols);
sudo_get_ttysize(STDERR_FILENO, &rows, &cols);
sudo_lbuf_init(&lbuf, usage_out, indent, NULL, cols);
if (strcmp(pname, "sudoedit") == 0) {
sudoedit = true;