diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-26 21:38:19 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-10-26 21:38:19 +0000 |
commit | e491732fb73358783214f02d576ce32416c6d6ef (patch) | |
tree | f4c05233ef921e02537a35e80717b74ea140d3f8 | |
parent | 6e4440fa464d99290aba7579f192bd7fa705833c (diff) |
Clear signal flags /before/ taking action and continue afterwards to reduce
chance of dropping signals. Pointed out by deraadt@.
-rw-r--r-- | usr.bin/tmux/client.c | 11 | ||||
-rw-r--r-- | usr.bin/tmux/server.c | 8 |
2 files changed, 12 insertions, 7 deletions
diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index 7be092bc935..32afa8c4bd6 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.26 2009/10/21 21:11:55 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.27 2009/10/26 21:38:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index 584bed87e20..15d0ae7ceb3 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.60 2009/10/22 19:41:51 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.61 2009/10/26 21:38:18 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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. */ |