Permalink
Browse files

Mask all handled signals while running pre-select actions.

This closes the race condition where a signal could be delivered just
before the pselect() call, which hangs until the next event.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
  • Loading branch information...
1 parent 1b5b975 commit c3031f3a7e1c44404723ae42a5ab4dc598c454cf @andersk andersk committed May 6, 2010
Showing with 5 additions and 0 deletions.
  1. +5 −0 select.c
View
5 select.c
@@ -272,6 +272,11 @@ void owl_select_mask_signals(sigset_t *oldmask) {
sigset_t set;
sigemptyset(&set);
+ sigaddset(&set, SIGWINCH);
+ sigaddset(&set, SIGALRM);
+ sigaddset(&set, SIGPIPE);
+ sigaddset(&set, SIGTERM);
+ sigaddset(&set, SIGHUP);
sigaddset(&set, SIGINT);
sigprocmask(SIG_BLOCK, &set, oldmask);
}

0 comments on commit c3031f3

Please sign in to comment.