Index: camel/camel-stub-marshal.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/camel/camel-stub-marshal.c,v
retrieving revision 1.5
diff -u -p -r1.5 camel-stub-marshal.c
--- camel/camel-stub-marshal.c	15 Jun 2006 20:36:50 -0000	1.5
+++ camel/camel-stub-marshal.c	24 Jul 2006 14:44:38 -0000
@@ -90,9 +90,10 @@ do_read (CamelStubMarshal *marshal, char
 	ssize_t n;
 	
 	do {
-		if ((n = camel_read (marshal->fd, buf + nread, len - nread)) > 0)
-			nread += n;
-	} while (n && nread < len && errno != EINTR);
+		if ((n = camel_read (marshal->fd, buf + nread, len - nread)) <= 0)
+			break;
+		nread += n;
+	} while (nread < len);
 	
 	if (nread < len) {
 		close (marshal->fd);
@@ -111,6 +112,7 @@ marshal_read (CamelStubMarshal *marshal,
 
 	if (avail == 0) {
 		g_byte_array_set_size (marshal->in, 4);
+		marshal->inptr = (char *)marshal->in->data + 4;
 		if (!do_read (marshal, (char *)marshal->in->data, 4))
 			return -1;
 		avail =  (int)marshal->in->data[0]        +
@@ -118,9 +120,12 @@ marshal_read (CamelStubMarshal *marshal,
 			((int)marshal->in->data[2] << 16) +
 			((int)marshal->in->data[3] << 24) - 4;
 		g_byte_array_set_size (marshal->in, avail + 4);
-		if (!do_read (marshal, ((char *)marshal->in->data) + 4, avail))
-			return -1;
 		marshal->inptr = (char *)marshal->in->data + 4;
+		if (!do_read (marshal, ((char *)marshal->in->data) + 4, avail)) {
+			g_byte_array_set_size (marshal->in, 4);
+			marshal->inptr = (char *)marshal->in->data + 4;
+			return -1;
+		}
 	}
 
 	if (len <= avail)
