aboutsummaryrefslogtreecommitdiff
path: root/slave.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-05-26 16:18:11 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-05-26 16:18:11 +0000
commite310487dae99e774fa31db41add33a114d09de6c (patch)
tree4f807fefa5fb60fc7475f5096a57ea7d8f2b01bf /slave.c
parentreadme: mention that -O3 is default in release builds (diff)
slave: set IUTF8
Diffstat (limited to 'slave.c')
-rw-r--r--slave.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/slave.c b/slave.c
index 26ccdf6f..30b5c4d9 100644
--- a/slave.c
+++ b/slave.c
@@ -8,6 +8,7 @@
#include <errno.h>
#include <assert.h>
#include <signal.h>
+#include <termios.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
@@ -99,6 +100,19 @@ slave_exec(int ptmx, char *argv[], int err_fd, bool login_shell)
goto err;
}
+ {
+ struct termios flags;
+ if (tcgetattr(pts, &flags) < 0) {
+ LOG_ERRNO("failed to get terminal attributes");
+ goto err;
+ }
+
+ flags.c_iflag |= IUTF8;
+ if (tcsetattr(pts, TCSANOW, &flags) < 0) {
+ LOG_ERRNO("failed to set IUTF8 terminal attribute");
+ goto err;
+ }
+ }
if (dup2(pts, STDIN_FILENO) == -1 ||
dup2(pts, STDOUT_FILENO) == -1 ||