diff options
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/term.c b/src/term.c index 8cc5dfd2a87..0eaf76a13df 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -25,7 +25,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 25 | #include <sys/file.h> | 25 | #include <sys/file.h> |
| 26 | #include <sys/time.h> | 26 | #include <sys/time.h> |
| 27 | #include <unistd.h> | 27 | #include <unistd.h> |
| 28 | #include <signal.h> | ||
| 29 | #include <setjmp.h> | 28 | #include <setjmp.h> |
| 30 | 29 | ||
| 31 | #include "lisp.h" | 30 | #include "lisp.h" |
| @@ -2932,7 +2931,10 @@ dissociate_if_controlling_tty (int fd) | |||
| 2932 | no_controlling_tty = 1; | 2931 | no_controlling_tty = 1; |
| 2933 | #else | 2932 | #else |
| 2934 | #ifdef TIOCNOTTY /* Try BSD ioctls. */ | 2933 | #ifdef TIOCNOTTY /* Try BSD ioctls. */ |
| 2935 | sigblock (sigmask (SIGTTOU)); | 2934 | sigset_t blocked; |
| 2935 | sigemptyset (&blocked); | ||
| 2936 | sigaddset (&blocked, SIGTTOU); | ||
| 2937 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | ||
| 2936 | fd = emacs_open (DEV_TTY, O_RDWR, 0); | 2938 | fd = emacs_open (DEV_TTY, O_RDWR, 0); |
| 2937 | if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1) | 2939 | if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1) |
| 2938 | { | 2940 | { |
| @@ -2940,7 +2942,7 @@ dissociate_if_controlling_tty (int fd) | |||
| 2940 | } | 2942 | } |
| 2941 | if (fd != -1) | 2943 | if (fd != -1) |
| 2942 | emacs_close (fd); | 2944 | emacs_close (fd); |
| 2943 | sigunblock (sigmask (SIGTTOU)); | 2945 | pthread_sigmask (SIG_UNBLOCK, &blocked, 0); |
| 2944 | #else | 2946 | #else |
| 2945 | /* Unknown system. */ | 2947 | /* Unknown system. */ |
| 2946 | croak (); | 2948 | croak (); |
| @@ -3074,9 +3076,14 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) | |||
| 3074 | 3076 | ||
| 3075 | /* On some systems, tgetent tries to access the controlling | 3077 | /* On some systems, tgetent tries to access the controlling |
| 3076 | terminal. */ | 3078 | terminal. */ |
| 3077 | sigblock (sigmask (SIGTTOU)); | 3079 | { |
| 3078 | status = tgetent (tty->termcap_term_buffer, terminal_type); | 3080 | sigset_t blocked; |
| 3079 | sigunblock (sigmask (SIGTTOU)); | 3081 | sigemptyset (&blocked); |
| 3082 | sigaddset (&blocked, SIGTTOU); | ||
| 3083 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | ||
| 3084 | status = tgetent (tty->termcap_term_buffer, terminal_type); | ||
| 3085 | pthread_sigmask (SIG_UNBLOCK, &blocked, 0); | ||
| 3086 | } | ||
| 3080 | 3087 | ||
| 3081 | if (status < 0) | 3088 | if (status < 0) |
| 3082 | { | 3089 | { |