abduco

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit 2de1946f1acba0228dbc98e502f04358db5e9d8d
parent eabb140a3868f9f8869248c4d047d57eb64b9b5f
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 16 Oct 2014 21:41:17 +0200

Use pselect instead of select

For the server case I see no such race condition.

Diffstat:
client.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/client.c b/client.c @@ -33,6 +33,12 @@ static void client_restore_terminal(void) { } static int client_mainloop(void) { + sigset_t emptyset, blockset; + sigemptyset(&emptyset); + sigemptyset(&blockset); + sigaddset(&blockset, SIGWINCH); + sigprocmask(SIG_BLOCK, &blockset, NULL); + client.need_resize = true; Packet pkt = { .type = MSG_ATTACH, @@ -60,7 +66,7 @@ static int client_mainloop(void) { } } - if (select(server.socket + 1, &fds, NULL, NULL, NULL) == -1) { + if (pselect(server.socket+1, &fds, NULL, NULL, NULL, &emptyset) == -1) { if (errno == EINTR) continue; die("client-mainloop");