summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorjmz <jmz@FreeBSD.org>1998-07-19 00:01:24 +0000
committerjmz <jmz@FreeBSD.org>1998-07-19 00:01:24 +0000
commit769444bdb4af6d54e79fb5d2e3b1fb9764bb1c80 (patch)
tree1b6594000fd5e3b012b6b46b0749e02c2734b23d /usr.bin
parent22c2ae2a77d8f1014a1953a1d3c66767e6ae9685 (diff)
downloadFreeBSD-src-769444bdb4af6d54e79fb5d2e3b1fb9764bb1c80.zip
FreeBSD-src-769444bdb4af6d54e79fb5d2e3b1fb9764bb1c80.tar.gz
'remaining' must be declared off_t instead of int to avoid FPE when the size of
the file to transfer is very large (577985293894855484 bytes in the case I encountered, but this was a buggy ftp server :-))
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ftp/util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index 67bfc24..a97af4d 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $Id: util.c,v 1.4 1997/12/16 08:17:26 ache Exp $ */
+/* $Id: util.c,v 1.5 1998/02/03 20:53:25 pst Exp $ */
/* $NetBSD: util.c,v 1.16.2.1 1997/11/18 01:02:33 mellon Exp $ */
/*
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$Id: util.c,v 1.4 1997/12/16 08:17:26 ache Exp $");
+__RCSID("$Id: util.c,v 1.5 1998/02/03 20:53:25 pst Exp $");
__RCSID_SOURCE("$NetBSD: util.c,v 1.16.2.1 1997/11/18 01:02:33 mellon Exp $");
#endif /* not lint */
@@ -589,7 +589,8 @@ progressmeter(flag)
struct timeval now, td, wait;
off_t cursize, abbrevsize;
double elapsed;
- int ratio, barlength, i, len, remaining;
+ int ratio, barlength, i, len;
+ off_t remaining;
char buf[256];
len = 0;
@@ -650,7 +651,7 @@ progressmeter(flag)
len += snprintf(buf + len, sizeof(buf) - len,
" - stalled -");
} else {
- remaining = (int)
+ remaining =
((filesize - restart_point) / (bytes / elapsed) - elapsed);
if (remaining >= 100 * SECSPERHOUR)
len += snprintf(buf + len, sizeof(buf) - len,
OpenPOWER on IntegriCloud