We should not read errno when reading 0 bytes, because it is not set. The connection has been closed. adium-1.5.10
authorThijs Alkemade <me@thijsalkema.de>
Fri, 21 Feb 2014 12:39:21 +0100
branchadium-1.5.10
changeset 5843 9b4717820ead
parent 5842 f8d2f42c499b
child 5844 aed198ae15cb
We should not read errno when reading 0 bytes, because it is not set. The connection has been closed.

Refs #16356
Plugins/Purple Service/libpurple_extensions/ssl-cdsa.c
--- a/Plugins/Purple Service/libpurple_extensions/ssl-cdsa.c	Fri Feb 21 11:53:35 2014 +0100
+++ b/Plugins/Purple Service/libpurple_extensions/ssl-cdsa.c	Fri Feb 21 12:39:21 2014 +0100
@@ -230,7 +230,10 @@
     for(;;) {
         bytesRead = 0;
         rrtn = read(sock, currData, bytesToGo);
-        if (rrtn <= 0) {
+		if (rrtn == 0) {
+			rtn = errSSLClosedGraceful;
+			break;
+		} else if (rrtn < 0) {
             /* this is guesswork... */
             int theErr = errno;
             switch(theErr) {