diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2016-03-02 22:43:52 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2016-03-04 15:12:20 +1100 |
commit | 8ef04d7a94bcdb8b0085fdd2a79a844b7d40792d (patch) | |
tree | 85f43c1a5cf399e8fa718f03753d504c0e73f74d | |
parent | b8d4eafe29684fe4f5bb587f7eab948e6ed62723 (diff) |
upstream commit
Improve accuracy of reported transfer speeds by waiting
for the ack from the other end. Pointed out by mmcc@, ok deraadt@ markus@
Upstream-ID: 99f1cf15c9a8f161086b814d414d862795ae153d
-rw-r--r-- | scp.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: scp.c,v 1.184 2015/11/27 00:49:31 deraadt Exp $ */ | 1 | /* $OpenBSD: scp.c,v 1.185 2016/03/02 22:43:52 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * scp - secure remote copy. This is basically patched BSD rcp which | 3 | * scp - secure remote copy. This is basically patched BSD rcp which |
4 | * uses ssh to do the data transfer (instead of using rcmd). | 4 | * uses ssh to do the data transfer (instead of using rcmd). |
@@ -848,8 +848,6 @@ next: if (fd != -1) { | |||
848 | haderr = errno; | 848 | haderr = errno; |
849 | } | 849 | } |
850 | unset_nonblock(remout); | 850 | unset_nonblock(remout); |
851 | if (showprogress) | ||
852 | stop_progress_meter(); | ||
853 | 851 | ||
854 | if (fd != -1) { | 852 | if (fd != -1) { |
855 | if (close(fd) < 0 && !haderr) | 853 | if (close(fd) < 0 && !haderr) |
@@ -861,6 +859,8 @@ next: if (fd != -1) { | |||
861 | else | 859 | else |
862 | run_err("%s: %s", name, strerror(haderr)); | 860 | run_err("%s: %s", name, strerror(haderr)); |
863 | (void) response(); | 861 | (void) response(); |
862 | if (showprogress) | ||
863 | stop_progress_meter(); | ||
864 | } | 864 | } |
865 | } | 865 | } |
866 | 866 | ||
@@ -1145,8 +1145,6 @@ bad: run_err("%s: %s", np, strerror(errno)); | |||
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | unset_nonblock(remin); | 1147 | unset_nonblock(remin); |
1148 | if (showprogress) | ||
1149 | stop_progress_meter(); | ||
1150 | if (count != 0 && wrerr == NO && | 1148 | if (count != 0 && wrerr == NO && |
1151 | atomicio(vwrite, ofd, bp->buf, count) != count) { | 1149 | atomicio(vwrite, ofd, bp->buf, count) != count) { |
1152 | wrerr = YES; | 1150 | wrerr = YES; |
@@ -1185,6 +1183,8 @@ bad: run_err("%s: %s", np, strerror(errno)); | |||
1185 | wrerrno = errno; | 1183 | wrerrno = errno; |
1186 | } | 1184 | } |
1187 | (void) response(); | 1185 | (void) response(); |
1186 | if (showprogress) | ||
1187 | stop_progress_meter(); | ||
1188 | if (setimes && wrerr == NO) { | 1188 | if (setimes && wrerr == NO) { |
1189 | setimes = 0; | 1189 | setimes = 0; |
1190 | if (utimes(np, tv) < 0) { | 1190 | if (utimes(np, tv) < 0) { |