View | Details | Raw Unified | Return to bug 799 | Differences between
and this patch

Collapse All | Expand All

(-)scp.c (-11 / +24 lines)
Lines 567-573 source(int argc, char **argv) Link Here
567
	static BUF buffer;
567
	static BUF buffer;
568
	BUF *bp;
568
	BUF *bp;
569
	off_t i, amt, statbytes;
569
	off_t i, amt, statbytes;
570
	size_t result;
570
	size_t result, o;
571
	ssize_t sresult;
571
	int fd = -1, haderr, indx;
572
	int fd = -1, haderr, indx;
572
	char *last, *name, buf[2048];
573
	char *last, *name, buf[2048];
573
	int len;
574
	int len;
Lines 648-660 next: if (fd != -1) { Link Here
648
				if (result != amt)
649
				if (result != amt)
649
					haderr = errno;
650
					haderr = errno;
650
			}
651
			}
651
			if (haderr)
652
			for (o = 0; o < amt;) {
652
				(void) atomicio(vwrite, remout, bp->buf, amt);
653
				sresult = write(remout, bp->buf + o, amt - o);
653
			else {
654
				if (sresult == 0) {
654
				result = atomicio(vwrite, remout, bp->buf, amt);
655
					sresult = -1;
655
				if (result != amt)
656
					errno = EPIPE;
656
					haderr = errno;
657
				}
657
				statbytes += result;
658
				if (sresult == -1) {
659
				   	if (errno == EAGAIN || errno == EINTR)
660
						continue;
661
					if (!haderr)
662
						haderr = errno;
663
					break;
664
				}
665
				statbytes += sresult;
666
				o += sresult;
658
			}
667
			}
659
			if (limit_rate)
668
			if (limit_rate)
660
				bwlimit(amt);
669
				bwlimit(amt);
Lines 792-798 sink(int argc, char **argv) Link Here
792
	} wrerr;
801
	} wrerr;
793
	BUF *bp;
802
	BUF *bp;
794
	off_t i;
803
	off_t i;
795
	size_t j, count;
804
	size_t count;
805
	ssize_t j;
796
	int amt, exists, first, ofd;
806
	int amt, exists, first, ofd;
797
	mode_t mode, omode, mask;
807
	mode_t mode, omode, mask;
798
	off_t size, statbytes;
808
	off_t size, statbytes;
Lines 974-981 bad: run_err("%s: %s", np, strerror(er Link Here
974
				amt = size - i;
984
				amt = size - i;
975
			count += amt;
985
			count += amt;
976
			do {
986
			do {
977
				j = atomicio(read, remin, cp, amt);
987
				j = read(remin, cp, amt);
978
				if (j == 0) {
988
				if (j == -1 &&
989
				    (errno == EAGAIN || errno == EINTR))
990
					continue;
991
				if (j <= 0) {
979
					run_err("%s", j ? strerror(errno) :
992
					run_err("%s", j ? strerror(errno) :
980
					    "dropped connection");
993
					    "dropped connection");
981
					exit(1);
994
					exit(1);

Return to bug 799