vzctl console: hack to force redraw on reattach

Since vzctl console is persistent, there might be a case when say vim
or bash is left on the console when we exit from it. The problem is
when we use vzctl console for the second time, nothing is re-drawn
despite the fact that we issue TIOCSWINSZ ioctl (which leads to SIGWINCH
being sent to an app running on that console). So second vzctl console
shows us empty screen. It would be nice to force app to re-draw it,
and while it can be done by pressing (usually) Ctrl-L (or changing the
xterm window size) this is not very intuitive.

The workaround implemented by this patch is to forcefully change the
terminal screen size, by adding one row, then send another TIOCSWINSZ
ioctl with the correct size. This way an application (that supports
SIGWINCH) is always redrawn.

This is a dirty hack, but it works.

Reported-by: Dan Bassett <dbassett@oreillyschool.com>
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed