diff options
| author | Richard M. Stallman | 1993-09-08 17:53:49 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-09-08 17:53:49 +0000 |
| commit | 61c3ce6288175422c805704d3a1fed70021f3ff7 (patch) | |
| tree | 5dbae819d6d368e61038e58452cf2321e3455ae8 /src | |
| parent | dd2281ae2a204fe83ccdcae665e34cedb4a480de (diff) | |
| download | emacs-61c3ce6288175422c805704d3a1fed70021f3ff7.tar.gz emacs-61c3ce6288175422c805704d3a1fed70021f3ff7.zip | |
(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'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 27 |
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) | |||
| 3356 | SELECT_TYPE mask; | 3356 | SELECT_TYPE mask; |
| 3357 | EMACS_TIME timeout; | 3357 | EMACS_TIME timeout; |
| 3358 | 3358 | ||
| 3359 | FD_SET(fd, &mask); | 3359 | FD_ZERO (&mask); |
| 3360 | FD_SET (fd, &mask); | ||
| 3360 | EMACS_SET_SECS_USECS (timeout, 0, 0); | 3361 | EMACS_SET_SECS_USECS (timeout, 0, 0); |
| 3361 | if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0, &timeout) | 3362 | if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0, &timeout) |
| 3362 | && !XStuffPending ()) | 3363 | && !XStuffPending ()) |
| 3363 | kill (getpid (), SIGHUP); | 3364 | kill (getpid (), SIGHUP); |
| 3364 | } | 3365 | } |
| 3365 | #endif /* ! defined (HAVE_SELECT) */ | 3366 | #endif /* HAVE_SELECT */ |
| 3366 | 3367 | ||
| 3367 | #ifndef HAVE_X11 | 3368 | #ifndef HAVE_X11 |
| 3368 | if (updating_frame == 0) | 3369 | if (updating_frame == 0) |
| @@ -4872,29 +4873,19 @@ Check the DISPLAY environment variable or use \"-d\"\n", | |||
| 4872 | #endif | 4873 | #endif |
| 4873 | 4874 | ||
| 4874 | if (ConnectionNumber (x_current_display) != 0) | 4875 | if (ConnectionNumber (x_current_display) != 0) |
| 4875 | { | 4876 | change_keyboard_wait_descriptor (ConnectionNumber (x_current_display)); |
| 4876 | dup2 (ConnectionNumber (x_current_display), 0); | 4877 | change_input_fd (ConnectionNumber (x_current_display)); |
| 4877 | |||
| 4878 | #ifndef SYSV_STREAMS | ||
| 4879 | /* Streams somehow keeps track of which descriptor number | ||
| 4880 | is being used to talk to X. So it is not safe to substitute | ||
| 4881 | descriptor 0. But it is safe to make descriptor 0 a copy of it. */ | ||
| 4882 | close (ConnectionNumber (x_current_display)); | ||
| 4883 | ConnectionNumber (x_current_display) = 0; /* Looks a little strange? | ||
| 4884 | * check the def of the macro; | ||
| 4885 | * it is a genuine lvalue */ | ||
| 4886 | #endif /* SYSV_STREAMS */ | ||
| 4887 | } | ||
| 4888 | 4878 | ||
| 4889 | #endif /* ! defined (HAVE_X11) */ | 4879 | #endif /* ! defined (HAVE_X11) */ |
| 4890 | 4880 | ||
| 4891 | #ifndef F_SETOWN_BUG | 4881 | #ifndef F_SETOWN_BUG |
| 4892 | #ifdef F_SETOWN | 4882 | #ifdef F_SETOWN |
| 4893 | old_fcntl_owner = fcntl (0, F_GETOWN, 0); | 4883 | old_fcntl_owner = fcntl (ConnectionNumber (x_current_display), F_GETOWN, 0); |
| 4894 | #ifdef F_SETOWN_SOCK_NEG | 4884 | #ifdef F_SETOWN_SOCK_NEG |
| 4895 | fcntl (0, F_SETOWN, -getpid ()); /* stdin is a socket here */ | 4885 | /* stdin is a socket here */ |
| 4886 | fcntl (ConnectionNumber (x_current_display), F_SETOWN, -getpid ()); | ||
| 4896 | #else /* ! defined (F_SETOWN_SOCK_NEG) */ | 4887 | #else /* ! defined (F_SETOWN_SOCK_NEG) */ |
| 4897 | fcntl (0, F_SETOWN, getpid ()); | 4888 | fcntl (ConnectionNumber (x_current_display), F_SETOWN, getpid ()); |
| 4898 | #endif /* ! defined (F_SETOWN_SOCK_NEG) */ | 4889 | #endif /* ! defined (F_SETOWN_SOCK_NEG) */ |
| 4899 | #endif /* ! defined (F_SETOWN) */ | 4890 | #endif /* ! defined (F_SETOWN) */ |
| 4900 | #endif /* F_SETOWN_BUG */ | 4891 | #endif /* F_SETOWN_BUG */ |