Make the X11 interface work again. Patch ported from https://github.com/tsutsui/mule1.1-netbsd: commit 9a72fba7d6302e637008dcde1968e51f5f57321b Author: tsugutomo enami Date: Sat Feb 28 10:46:25 2015 +0900 Copy O_NONBLOCK bit to old_fcntl_flags so that it won't be lost by unrequest_sigio(). --- emacs-18.59-orig/src/ChangeLog +++ emacs-18.59/src/ChangeLog @@ -1,3 +1,8 @@ +2018-07-01 Ulrich Mueller + + * x11term.c (x_init_1): Save the O_NONBLOCK bit, so that it won't + be lost by unrequest_sigio(). Patch from Tsugutomo Enami. + 2017-12-07 Ulrich Mueller * s-linux.h (SIGSYS): Don't redefine. Fixes compilation with --- emacs-18.59-orig/src/x11term.c +++ emacs-18.59/src/x11term.c @@ -2105,6 +2105,9 @@ #ifdef F_SETOWN extern int old_fcntl_owner; #endif +#if defined(F_SETFL) && defined(FASYNC) + extern int old_fcntl_flags; +#endif dup2 (ConnectionNumber(XXdisplay), 0); #ifndef SYSV_STREAMS @@ -2131,6 +2134,13 @@ fcntl (0, F_SETOWN, getpid ()); #endif /* F_SETOWN_SOCK_NEG */ #endif /* F_SETOWN */ +#if defined(F_SETFL) && defined(FASYNC) + /* + * Since libxcb sets O_NONBLOCK, copy the bit so that it won't + * dropped by unrequest_sigio(). + */ + old_fcntl_flags = fcntl (0, F_GETFL, 0) & ~FASYNC; +#endif /* Enable interrupt_input because otherwise we cannot asynchronously detect C-g sent as a keystroke event from the X server. */