diff common-channel.c @ 1196:a29559086628 coverity

merge
author Matt Johnston <matt@ucc.asn.au>
date Wed, 02 Dec 2015 22:37:51 +0800
parents af940cefdba1
children 750ec4ec4cbe
line wrap: on
line diff
--- a/common-channel.c	Mon Nov 23 23:04:48 2015 +0800
+++ b/common-channel.c	Wed Dec 02 22:37:51 2015 +0800
@@ -255,8 +255,6 @@
 		}
 	}
 
-	ses.channel_signal_pending = 0;
-
 #ifdef USING_LISTENERS
 	handle_listeners(readfds);
 #endif
@@ -447,9 +445,10 @@
 			close_chan_fd(channel, fd, SHUT_WR);
 			return DROPBEAR_FAILURE;
 		}
+	} else {
+		cbuf_incrread(cbuf, written);
+		channel->recvdonelen += written;
 	}
-	cbuf_incrread(cbuf, written);
-	channel->recvdonelen += written;
 	return DROPBEAR_SUCCESS;
 }
 #endif /* !HAVE_WRITEV */
@@ -462,7 +461,7 @@
 	unsigned char *circ_p1, *circ_p2;
 	unsigned int circ_len1, circ_len2;
 	int io_count = 0;
-	int cbuf_written;
+
 	ssize_t written;
 
 	cbuf_readptrs(cbuf, &circ_p1, &circ_len1, &circ_p2, &circ_len2);
@@ -510,14 +509,14 @@
 			close_chan_fd(channel, fd, SHUT_WR);
 			return DROPBEAR_FAILURE;
 		}
-	} 
-
-	cbuf_written = MIN(circ_len1+circ_len2, (unsigned int)written);
-	cbuf_incrread(cbuf, cbuf_written);
-	if (morelen) {
-		*morelen = written - cbuf_written;
+	} else {
+		int cbuf_written = MIN(circ_len1+circ_len2, (unsigned int)written);
+		cbuf_incrread(cbuf, cbuf_written);
+		if (morelen) {
+			*morelen = written - cbuf_written;
+		}
+		channel->recvdonelen += written;
 	}
-	channel->recvdonelen += written;
 	return DROPBEAR_SUCCESS;
 }
 #endif /* HAVE_WRITEV */