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

@@ -623,7 +623,7 @@ get_user_info(struct user_details *ud)
goto oom;
ud->host = info[i] + sizeof("host=") - 1;
sudo_get_ttysize(&ud->ts_rows, &ud->ts_cols);
sudo_get_ttysize(STDERR_FILENO, &ud->ts_rows, &ud->ts_cols);
if (asprintf(&info[++i], "lines=%d", ud->ts_rows) == -1)
goto oom;
if (asprintf(&info[++i], "cols=%d", ud->ts_cols) == -1)