aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-06-02 17:59:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-06-02 17:59:28 +0000
commit29630ac92e6303e8196aef2eb32092e1e36d5252 (patch)
treeeb92fc05b0e5174ac76088b294dfac7bc6e0f5e7 /terminal.c
parentmeson/PKGBUILD: require fcft 2.1.1 (diff)
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.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/terminal.c b/terminal.c
index 4f9d1d5d..8181a610 100644
--- a/terminal.c
+++ b/terminal.c
@@ -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)