aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorPaul Eggert2018-11-26 08:25:36 -0800
committerPaul Eggert2018-11-26 11:39:44 -0800
commit0331f2f4c5d7d9221522e231ebd5e4f20868c2b7 (patch)
tree823516bbb6e7aa324390af1b3d1b280b5c758d6e /admin
parentf3328f995ee316cffa1a86117e6da2ba299d2c90 (diff)
downloademacs-0331f2f4c5d7d9221522e231ebd5e4f20868c2b7.tar.gz
emacs-0331f2f4c5d7d9221522e231ebd5e4f20868c2b7.zip
emacsclient: fix some races on POSIX systems
Fix some longstanding race conditions due to emacsclient’s use of ‘signal’ instead of ‘sigaction’ and its use of nested signal handlers. These races could cause premature exit or incorrect commands sent to Emacs. * lib-src/emacsclient.c (signal) [!WINDOWSNT]: Do not undef. (emacs_socket): Remove this static variable. It is now a parameter. (send_to_emacs): Do not exit merely because ‘send’ was interrupted. Instead, act on the signal if possible, and then retry the ‘send’. (pass_signal_to_emacs): Remove; now done by act_on_signals. (reinstall_handler_if_needed, handle_sigttou, handle_sigwinch) (install_handler): New functions. (got_sigcont, got_sigtstp, got_sigttou, got_sigwinch): New globals, used for more-portable signal handling. (handle_sigcont, handle_sigtstp): Just set the static var; other actions are now done later by act_on_signals. (install_handler): New function that arranges for signals to never be reset to default, on modern POSIX platforms. This fixes some races. (act_on_signals): New function. When acting on SIGCONT, don’t bother calling getpgrp if tcgetpgrp fails. (start_daemon_and_retry_set_socket): Return the socket rather than setting a global variable. All uses changed. (flush_stdout): New function that acts on signals received while flushing. (main): Use it. emacs_socket is now a local var. Act on signals received during recv.
Diffstat (limited to 'admin')
0 files changed, 0 insertions, 0 deletions