aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-10-26 21:38:18 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-10-26 21:38:18 +0000
commita8b1379ccbfbe7f1d7732147c4969bb92499555d (patch)
tree17a3c083aa823e3e13de493a4017cff9da3b65a8
parent6b804f3a4aaffc26d419b3ad7f96bd54456cdfc5 (diff)
downloadrtmux-a8b1379ccbfbe7f1d7732147c4969bb92499555d.tar.gz
rtmux-a8b1379ccbfbe7f1d7732147c4969bb92499555d.tar.bz2
rtmux-a8b1379ccbfbe7f1d7732147c4969bb92499555d.zip
Clear signal flags /before/ taking action and continue afterwards to reduce
chance of dropping signals. Pointed out by deraadt@.
-rw-r--r--client.c9
-rw-r--r--server.c6
2 files changed, 10 insertions, 5 deletions
diff --git a/client.c b/client.c
index 7959559b..a5c5e39e 100644
--- a/client.c
+++ b/client.c
@@ -185,17 +185,20 @@ client_main(void)
client_write_server(MSG_EXITING, NULL, 0);
}
if (sigchld) {
- waitpid(WAIT_ANY, NULL, WNOHANG);
sigchld = 0;
+ waitpid(WAIT_ANY, NULL, WNOHANG);
+ continue;
}
if (sigwinch) {
+ sigwinch = 0;
client_write_server(MSG_RESIZE, NULL, 0);
- sigwinch = 0;
+ continue;
}
if (sigcont) {
+ sigcont = 0;
siginit();
client_write_server(MSG_WAKEUP, NULL, 0);
- sigcont = 0;
+ continue;
}
pfd.fd = client_ibuf.fd;
diff --git a/server.c b/server.c
index e1ec4eb8..78c5af94 100644
--- a/server.c
+++ b/server.c
@@ -328,15 +328,17 @@ server_main(int srv_fd)
/* Handle child exit. */
if (sigchld) {
- server_child_signal();
sigchld = 0;
+ server_child_signal();
+ continue;
}
/* Recreate socket on SIGUSR1. */
if (sigusr1) {
+ sigusr1 = 0;
close(srv_fd);
srv_fd = server_create_socket();
- sigusr1 = 0;
+ continue;
}
/* Initialise pollfd array and add server socket. */