diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-04-16 16:05:15 -0600 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-04-16 16:05:15 -0600 |
commit | 7da96d52ace67b883e59fdefcec62fa8ed87a4aa (patch) | |
tree | d719bc8e1a8bfa4f7d80faf5c61355fc6ebed56a | |
parent | 8c9bdeb4ab003fe30e7a981412511997c02f75b5 (diff) | |
download | sudo-7da96d52ace67b883e59fdefcec62fa8ed87a4aa.tar.gz |
get_user_info: pass sudo_get_ttysize() the fd of /dev/tty, not stderr.
Both the plugin API and the main event loop expect lines/cols to
refer to the user's terminal, so using /dev/tty is better here.
-rw-r--r-- | src/sudo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sudo.c b/src/sudo.c index b55859165..ebbc4e9bb 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -533,6 +533,7 @@ get_user_info(struct user_details *ud) ud->pgid = getpgid(0); fd = open(_PATH_TTY, O_RDWR); if (fd != -1) { + sudo_get_ttysize(fd, &ud->ts_rows, &ud->ts_cols); if ((ud->tcpgid = tcgetpgrp(fd)) == -1) ud->tcpgid = 0; close(fd); @@ -623,7 +624,6 @@ get_user_info(struct user_details *ud) goto oom; ud->host = info[i] + sizeof("host=") - 1; - 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) |