summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-09-08 17:53:49 +0000
committerRichard M. Stallman <rms@gnu.org>1993-09-08 17:53:49 +0000
commit61c3ce6288175422c805704d3a1fed70021f3ff7 (patch)
tree5dbae819d6d368e61038e58452cf2321e3455ae8
parentdd2281ae2a204fe83ccdcae665e34cedb4a480de (diff)
downloademacs-61c3ce6288175422c805704d3a1fed70021f3ff7.tar.gz
(x_term_init): Call change_keyboard_wait_descriptor,
instead of dup2. Use the existing X desc number in fcntl calls. (XTread_socket): Don't forget to clear out `mask'.
-rw-r--r--src/xterm.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/xterm.c b/src/xterm.c
index c6fd73c13b0..0379ef7bda8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3356,13 +3356,14 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
SELECT_TYPE mask;
EMACS_TIME timeout;
- FD_SET(fd, &mask);
+ FD_ZERO (&mask);
+ FD_SET (fd, &mask);
EMACS_SET_SECS_USECS (timeout, 0, 0);
if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0, &timeout)
&& !XStuffPending ())
kill (getpid (), SIGHUP);
}
-#endif /* ! defined (HAVE_SELECT) */
+#endif /* HAVE_SELECT */
#ifndef HAVE_X11
if (updating_frame == 0)
@@ -4872,29 +4873,19 @@ Check the DISPLAY environment variable or use \"-d\"\n",
#endif
if (ConnectionNumber (x_current_display) != 0)
- {
- dup2 (ConnectionNumber (x_current_display), 0);
-
-#ifndef SYSV_STREAMS
- /* Streams somehow keeps track of which descriptor number
- is being used to talk to X. So it is not safe to substitute
- descriptor 0. But it is safe to make descriptor 0 a copy of it. */
- close (ConnectionNumber (x_current_display));
- ConnectionNumber (x_current_display) = 0; /* Looks a little strange?
- * check the def of the macro;
- * it is a genuine lvalue */
-#endif /* SYSV_STREAMS */
- }
+ change_keyboard_wait_descriptor (ConnectionNumber (x_current_display));
+ change_input_fd (ConnectionNumber (x_current_display));
#endif /* ! defined (HAVE_X11) */
#ifndef F_SETOWN_BUG
#ifdef F_SETOWN
- old_fcntl_owner = fcntl (0, F_GETOWN, 0);
+ old_fcntl_owner = fcntl (ConnectionNumber (x_current_display), F_GETOWN, 0);
#ifdef F_SETOWN_SOCK_NEG
- fcntl (0, F_SETOWN, -getpid ()); /* stdin is a socket here */
+ /* stdin is a socket here */
+ fcntl (ConnectionNumber (x_current_display), F_SETOWN, -getpid ());
#else /* ! defined (F_SETOWN_SOCK_NEG) */
- fcntl (0, F_SETOWN, getpid ());
+ fcntl (ConnectionNumber (x_current_display), F_SETOWN, getpid ());
#endif /* ! defined (F_SETOWN_SOCK_NEG) */
#endif /* ! defined (F_SETOWN) */
#endif /* F_SETOWN_BUG */