components/mutt/patches/7095450-hang-in-read.patch
author Marcel Telka <marcel.telka@oracle.com>
Sat, 10 Mar 2012 07:29:44 +0100
changeset 728 61487136e37d
permissions -rw-r--r--
7095450 Hang in BIO_read()
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
728
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     1
--- mutt-1.5.21/mutt_socket.c.orig
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     2
+++ mutt-1.5.21/mutt_socket.c
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     3
@@ -78,7 +78,11 @@
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     4
   if (conn->fd < 0)
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     5
     dprint (1, (debugfile, "mutt_socket_close: Attempt to close closed connection.\n"));
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     6
   else
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     7
+  {
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     8
+    mutt_allow_interrupt (1);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
     9
     rc = conn->conn_close (conn);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    10
+    mutt_allow_interrupt (0);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    11
+  }
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    12
 
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    13
   conn->fd = -1;
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    14
   conn->ssf = 0;
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    15
@@ -96,7 +99,9 @@
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    16
     return -1;
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    17
   }
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    18
 
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    19
+  mutt_allow_interrupt (1);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    20
   rc = conn->conn_read (conn, buf, len);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    21
+  mutt_allow_interrupt (0);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    22
   /* EOF */
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    23
   if (rc == 0)
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    24
   {
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    25
@@ -127,7 +132,10 @@
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    26
   
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    27
   while (sent < len)
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    28
   {
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    29
-    if ((rc = conn->conn_write (conn, buf + sent, len - sent)) < 0)
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    30
+    mutt_allow_interrupt (1);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    31
+    rc = conn->conn_write (conn, buf + sent, len - sent);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    32
+    mutt_allow_interrupt (0);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    33
+    if (rc < 0)
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    34
     {
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    35
       dprint (1, (debugfile,
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    36
                   "mutt_socket_write: error writing (%s), closing socket\n",
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    37
@@ -169,7 +177,11 @@
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    38
   if (conn->bufpos >= conn->available)
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    39
   {
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    40
     if (conn->fd >= 0)
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    41
+    {
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    42
+      mutt_allow_interrupt (1);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    43
       conn->available = conn->conn_read (conn, conn->inbuf, sizeof (conn->inbuf));
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    44
+      mutt_allow_interrupt (0);
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    45
+    }
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    46
     else
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    47
     {
61487136e37d 7095450 Hang in BIO_read()
Marcel Telka <marcel.telka@oracle.com>
parents:
diff changeset
    48
       dprint (1, (debugfile, "mutt_socket_readchar: attempt to read from closed connection.\n"));