Fwd: COLUMNS and LINES environment variables

Martti Kühne mysatyre at gmail.com
Tue Sep 1 17:36:29 AEST 2015

On Tue, Sep 1, 2015 at 2:00 AM, Damien Miller <djm at mindrot.org> wrote:
> The problem with doing it via enviornment variables is that they
> will become invalid if the client ever changes the size of their
> window. TTYs support sending SIGWINCH for this and OpenSSH handles
> this already.
> Your program should be able to get the correct window size at any
> time using:
> struct winsize ws;
> if (ioctl(ttyfd, TIOCGWINSZ, &ws) != 0)
>         error(...);
> -d

The issue I have is the redirection of stdin/fd0 which is equal to
in_fd in the function where the patch applied. It must be a pipe, or
no data will be received by the program due to how file descriptors
work. An alternative, probably more agreeable solution would be to
open /dev/tty exclusively for the ioctl.
Thanks for your consideration.


More information about the openssh-unix-dev mailing list