Package: mutt Version: 1.7.2-1 Severity: normal Tags: patch The code in raw_socket_read function invokes the read system call and checks if there was an error, indicated by a return value of -1.
If read doesn't return an error, but the global variable errno is set to EINTR then error handling runs. This is incorrect, error handling should only happen if read returns -1. When read doesn't result in an error it doesn't set errno. The same is true for raw_socket_write and the write sytem call. This makes mutt close to unusable when interacting with a non-SSL IMAP server. Mutt gives this message "Error talking to localhost (Interrupted system call)" and closes the mailbox. There is a patch to fix this problem. --- mutt-1.7.2/mutt_socket.c 2017-02-17 20:34:41.000000000 +0000 +++ new/mutt_socket.c 2017-02-17 20:34:31.791530257 +0000 @@ -397,46 +397,36 @@ int raw_socket_read (CONNECTION* conn, char* buf, size_t len) { int rc; mutt_allow_interrupt (1); if ((rc = read (conn->fd, buf, len)) == -1) { 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); - } + } mutt_allow_interrupt (0); return rc; } int raw_socket_write (CONNECTION* conn, const char* buf, size_t count) { int rc; mutt_allow_interrupt (1); if ((rc = write (conn->fd, buf, count)) == -1) { 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); } mutt_allow_interrupt (0); return rc; } int raw_socket_poll (CONNECTION* conn) { fd_set rfds; struct timeval tv = { 0, 0 };