mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
term: set an initial TIOCSWINSZ right after opening the pty
Since foot is pretty aggressive about spawning the client early, it was possible for a fast client to read a 0x0 terminal size. Not all clients coped well. Closes #20.
This commit is contained in:
parent
5ff9bd5c9d
commit
29630ac92e
2 changed files with 10 additions and 0 deletions
|
|
@ -48,6 +48,8 @@
|
||||||
* Selection of double-width characters. It is no longer possible to
|
* Selection of double-width characters. It is no longer possible to
|
||||||
select half of a double-width character.
|
select half of a double-width character.
|
||||||
* Draw hollow block cursor on top of 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
|
### Security
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
|
|
@ -759,6 +760,13 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
|
||||||
goto close_fds;
|
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;
|
int ptmx_flags;
|
||||||
if ((ptmx_flags = fcntl(ptmx, F_GETFL)) < 0 ||
|
if ((ptmx_flags = fcntl(ptmx, F_GETFL)) < 0 ||
|
||||||
fcntl(ptmx, F_SETFL, ptmx_flags | O_NONBLOCK) < 0)
|
fcntl(ptmx, F_SETFL, ptmx_flags | O_NONBLOCK) < 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue