Handle EINTR from connect(2) gracefully

Resizing the window early on may return early due to SIGWINCH.
Continue asynchronously in that case instead of exiting.
weechat-hashes
Klemens Nanni 2021-06-20 22:18:33 +00:00 committed by C. McEnroe
parent a79a3fc9f6
commit 2b7f62dbd4
1 changed files with 2 additions and 0 deletions

2
irc.c
View File

@ -27,6 +27,7 @@
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdarg.h>
@ -148,6 +149,7 @@ int ircConnect(const char *bindHost, const char *host, const char *port) {
error = connect(sock, ai->ai_addr, ai->ai_addrlen);
if (!error) break;
if (error && errno == EINTR) break; // connect continues asynchronously
close(sock);
sock = -1;