From: Edward Betts Date: Fri, 24 Feb 2017 16:37:16 +0000 (+0000) Subject: handle sigint within socket operations (#411) X-Git-Tag: neomutt-20170225~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46b8dbc34a3a9e2ae2899a1bffef044962c6d128;p=neomutt handle sigint within socket operations (#411) When trying to use mutt with non-SSL IMAP it intermittently throws 'Error talking to localhost (Interrupted system call)' and closes the mailbox. Closes #407 Closes #408 Closes #411 --- diff --git a/mutt_socket.c b/mutt_socket.c index 5995f7c15..2b2af7f26 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -402,14 +402,18 @@ int raw_socket_read (CONNECTION* conn, char* buf, size_t len) mutt_error (_("Error talking to %s (%s)"), conn->account.host, strerror (errno)); mutt_sleep (2); - } else if (errno == EINTR) { - rc = -1; - mutt_error (_("Error talking to %s (%s)"), conn->account.host, - strerror (errno)); - mutt_sleep (2); - } + SigInt = 0; + } mutt_allow_interrupt (0); + if (SigInt) + { + mutt_error (_("Connection to %s has been aborted"), conn->account.host); + mutt_sleep (2); + SigInt = 0; + rc = -1; + } + return rc; } @@ -423,14 +427,18 @@ int raw_socket_write (CONNECTION* conn, const char* buf, size_t count) mutt_error (_("Error talking to %s (%s)"), conn->account.host, strerror (errno)); mutt_sleep (2); - } else if (errno == EINTR) { - rc = -1; - mutt_error (_("Error talking to %s (%s)"), conn->account.host, - strerror (errno)); - mutt_sleep (2); + SigInt = 0; } mutt_allow_interrupt (0); + if (SigInt) + { + mutt_error (_("Connection to %s has been aborted"), conn->account.host); + mutt_sleep (2); + SigInt = 0; + rc = -1; + } + return rc; }