comparison 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
comparison
equal deleted inserted replaced
1173:d734fe76b72f 1196:a29559086628
253 if (do_check_close) { 253 if (do_check_close) {
254 check_close(channel); 254 check_close(channel);
255 } 255 }
256 } 256 }
257 257
258 ses.channel_signal_pending = 0;
259
260 #ifdef USING_LISTENERS 258 #ifdef USING_LISTENERS
261 handle_listeners(readfds); 259 handle_listeners(readfds);
262 #endif 260 #endif
263 } 261 }
264 262
445 if (errno != EINTR && errno != EAGAIN) { 443 if (errno != EINTR && errno != EAGAIN) {
446 TRACE(("channel IO write error fd %d %s", fd, strerror(errno))) 444 TRACE(("channel IO write error fd %d %s", fd, strerror(errno)))
447 close_chan_fd(channel, fd, SHUT_WR); 445 close_chan_fd(channel, fd, SHUT_WR);
448 return DROPBEAR_FAILURE; 446 return DROPBEAR_FAILURE;
449 } 447 }
450 } 448 } else {
451 cbuf_incrread(cbuf, written); 449 cbuf_incrread(cbuf, written);
452 channel->recvdonelen += written; 450 channel->recvdonelen += written;
451 }
453 return DROPBEAR_SUCCESS; 452 return DROPBEAR_SUCCESS;
454 } 453 }
455 #endif /* !HAVE_WRITEV */ 454 #endif /* !HAVE_WRITEV */
456 455
457 #ifdef HAVE_WRITEV 456 #ifdef HAVE_WRITEV
460 459
461 struct iovec iov[3]; 460 struct iovec iov[3];
462 unsigned char *circ_p1, *circ_p2; 461 unsigned char *circ_p1, *circ_p2;
463 unsigned int circ_len1, circ_len2; 462 unsigned int circ_len1, circ_len2;
464 int io_count = 0; 463 int io_count = 0;
465 int cbuf_written; 464
466 ssize_t written; 465 ssize_t written;
467 466
468 cbuf_readptrs(cbuf, &circ_p1, &circ_len1, &circ_p2, &circ_len2); 467 cbuf_readptrs(cbuf, &circ_p1, &circ_len1, &circ_p2, &circ_len2);
469 468
470 if (circ_len1 > 0) { 469 if (circ_len1 > 0) {
508 if (errno != EINTR && errno != EAGAIN) { 507 if (errno != EINTR && errno != EAGAIN) {
509 TRACE(("channel IO write error fd %d %s", fd, strerror(errno))) 508 TRACE(("channel IO write error fd %d %s", fd, strerror(errno)))
510 close_chan_fd(channel, fd, SHUT_WR); 509 close_chan_fd(channel, fd, SHUT_WR);
511 return DROPBEAR_FAILURE; 510 return DROPBEAR_FAILURE;
512 } 511 }
513 } 512 } else {
514 513 int cbuf_written = MIN(circ_len1+circ_len2, (unsigned int)written);
515 cbuf_written = MIN(circ_len1+circ_len2, (unsigned int)written); 514 cbuf_incrread(cbuf, cbuf_written);
516 cbuf_incrread(cbuf, cbuf_written); 515 if (morelen) {
517 if (morelen) { 516 *morelen = written - cbuf_written;
518 *morelen = written - cbuf_written; 517 }
519 } 518 channel->recvdonelen += written;
520 channel->recvdonelen += written; 519 }
521 return DROPBEAR_SUCCESS; 520 return DROPBEAR_SUCCESS;
522 } 521 }
523 #endif /* HAVE_WRITEV */ 522 #endif /* HAVE_WRITEV */
524 523
525 /* Called to write data out to the local side of the channel. 524 /* Called to write data out to the local side of the channel.