diff options
author | 2013-09-19 00:24:52 +0000 | |
---|---|---|
committer | 2013-09-19 00:24:52 +0000 | |
commit | c58dd1847f86a2d6205aed0259de4885ac028b54 (patch) | |
tree | acd0d1676a31027cc3034cf96886acafc04cf870 /usr.bin/ssh/progressmeter.c | |
parent | get ethernet working on the edgerouter lite (diff) | |
download | wireguard-openbsd-c58dd1847f86a2d6205aed0259de4885ac028b54.tar.xz wireguard-openbsd-c58dd1847f86a2d6205aed0259de4885ac028b54.zip |
store the initial file offset so the progress meter doesn't freak out
when resuming sftp transfers. bz#2137; patch from Iain Morgan; ok dtucker@
Diffstat (limited to 'usr.bin/ssh/progressmeter.c')
-rw-r--r-- | usr.bin/ssh/progressmeter.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/ssh/progressmeter.c b/usr.bin/ssh/progressmeter.c index 1840b206124..5c4ae992d57 100644 --- a/usr.bin/ssh/progressmeter.c +++ b/usr.bin/ssh/progressmeter.c @@ -1,4 +1,4 @@ -/* $OpenBSD: progressmeter.c,v 1.39 2013/06/02 13:33:05 dtucker Exp $ */ +/* $OpenBSD: progressmeter.c,v 1.40 2013/09/19 00:24:52 djm Exp $ */ /* * Copyright (c) 2003 Nils Nordman. All rights reserved. * @@ -64,6 +64,7 @@ static void update_progress_meter(int); static time_t start; /* start progress */ static time_t last_update; /* last progress update */ static char *file; /* name of the file being transferred */ +static off_t start_pos; /* initial position of transfer */ static off_t end_pos; /* ending position of transfer */ static off_t cur_pos; /* transfer position as of last refresh */ static volatile off_t *counter; /* progress counter */ @@ -127,7 +128,7 @@ refresh_progress_meter(void) int i, len; int file_len; - transferred = *counter - cur_pos; + transferred = *counter - (cur_pos ? cur_pos : start_pos); cur_pos = *counter; now = monotime(); bytes_left = end_pos - cur_pos; @@ -137,7 +138,7 @@ refresh_progress_meter(void) else { elapsed = now - start; /* Calculate true total speed when done */ - transferred = end_pos; + transferred = end_pos - start_pos; bytes_per_second = 0; } @@ -249,6 +250,7 @@ start_progress_meter(char *f, off_t filesize, off_t *ctr) { start = last_update = monotime(); file = f; + start_pos = *ctr; end_pos = filesize; cur_pos = 0; counter = ctr; |