Merge branch 'initial-tiocswinsz'

This commit is contained in:
Daniel Eklöf 2020-06-03 17:29:45 +02:00
commit f1c8ccddde
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 10 additions and 0 deletions

View file

@ -48,6 +48,8 @@
* Selection of double-width characters. It is no longer possible to
select half of a double-width character.
* Draw hollow block cursor on top of character.
* Set an initial `TIOCSWINSZ`. This ensures clients never reads a
`0x0` terminal size (https://codeberg.org/dnkl/foot/issues/20).
### Security

View file

@ -8,6 +8,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
#include <sys/timerfd.h>
@ -759,6 +760,13 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
goto close_fds;
}
if (ioctl(ptmx, TIOCSWINSZ,
&(struct winsize){.ws_row = 24, .ws_col = 80}) < 0)
{
LOG_ERRNO("failed to set initial TIOCSWINSZ");
goto close_fds;
}
int ptmx_flags;
if ((ptmx_flags = fcntl(ptmx, F_GETFL)) < 0 ||
fcntl(ptmx, F_SETFL, ptmx_flags | O_NONBLOCK) < 0)