--- xterm-325.orig/main.c 2016-06-01 11:13:46.000000000 +0200 +++ xterm-325/main.c 2016-09-09 22:25:42.000000000 +0200 @@ -2637,7 +2637,7 @@ main(int argc, char *argv[]ENVP_ARG) } } -#if defined(__osf__) || (defined(__GLIBC__) && !defined(USE_USG_PTYS)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) +#if defined(__osf__) || (defined(__linux__) && !defined(USE_USG_PTYS)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) #define USE_OPENPTY 1 static int opened_tty = -1; #endif @@ -3204,7 +3204,7 @@ find_utmp(struct UTMP_STR *tofind) #define close_fd(fd) close(fd), fd = -1 -#if defined(TIOCNOTTY) && (!defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))) +#if defined(TIOCNOTTY) && defined(__linux__) #define USE_NO_DEV_TTY 1 #else #define USE_NO_DEV_TTY 0 @@ -3537,7 +3537,8 @@ spawnXTerm(XtermWidget xw) } #endif /* __MVS__ */ - close_fd(ttyfd); + // do not close it here + // close_fd(ttyfd); } if (get_pty(&screen->respond, XDisplayString(screen->display))) { @@ -3966,8 +3967,9 @@ spawnXTerm(XtermWidget xw) eg. by lineedit in the shell, or emacs, etc. then tio will have bad values. Let's just get termio from the new tty and tailor it. */ - if (ttyGetAttr(ttyfd, &tio) == -1) + if (ttyGetAttr(ttyfd, &tio) == -1) { SysError(ERROR_TIOCGETP); + } tio.c_lflag |= ECHOE; #endif /* umips */ /* Now is also the time to change the modes of the