04a9bc
--- netkit-ftp-0.17/ftp/ftp.c.rasold	2005-08-22 14:22:50.000000000 +0200
04a9bc
+++ netkit-ftp-0.17/ftp/ftp.c	2005-08-22 14:23:02.000000000 +0200
04a9bc
@@ -139,7 +139,7 @@
04a9bc
 static char *gunique(char *);
04a9bc
 static void proxtrans(const char *cmd, char *local, char *remote);
04a9bc
 static int initconn(void);
04a9bc
-static void ptransfer(const char *direction, long bytes, 
04a9bc
+static void ptransfer(const char *direction, long long bytes, 
04a9bc
 		      const struct timeval *t0, 
04a9bc
 		      const struct timeval *t1);
04a9bc
 static void tvsub(struct timeval *tdiff, 
04a9bc
@@ -579,7 +579,7 @@
04a9bc
 	int (*volatile closefunc)(FILE *);
04a9bc
 	void (*volatile oldintr)(int);
04a9bc
 	void (*volatile oldintp)(int);
04a9bc
-	volatile long bytes = 0, hashbytes = HASHBYTES;
04a9bc
+	volatile long long bytes = 0, hashbytes = HASHBYTES;
04a9bc
 	char buf[BUFSIZ], *bufp;
04a9bc
 	const char *volatile lmode;
04a9bc
 
04a9bc
@@ -713,14 +713,14 @@
04a9bc
 				if ((d = write(fileno(dout), bufp, c)) <= 0)
04a9bc
 					break;
04a9bc
 			if (hash) {
04a9bc
-				while (bytes >= hashbytes) {
04a9bc
-					(void) putchar('#');
04a9bc
-					hashbytes += HASHBYTES;
04a9bc
-				}
04a9bc
-				(void) fflush(stdout);
04a9bc
-			}
04a9bc
+				while (bytes >= hashbytes) {        /* <-- 'long long' signed overflow is  */
04a9bc
+					(void) putchar('#');        /* possible. In this case, we can      */
04a9bc
+					hashbytes += HASHBYTES;     /* 'cycle' there for very long time.   */
04a9bc
+				}                                   /* Search 'hasbytes' in file down,     */
04a9bc
+				(void) fflush(stdout);              /* there are similar parts.            */
04a9bc
+			}                                           /*           <praszyk@redhat.com>      */
04a9bc
 			if (tick && (bytes >= hashbytes)) {
04a9bc
-				printf("\rBytes transferred: %ld", bytes);
04a9bc
+				printf("\rBytes transferred: %lld", bytes);
04a9bc
 				(void) fflush(stdout);
04a9bc
 				while (bytes >= hashbytes)
04a9bc
 					hashbytes += TICKBYTES;
04a9bc
@@ -733,7 +733,7 @@
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (tick) {
04a9bc
-			(void) printf("\rBytes transferred: %ld\n", bytes);
04a9bc
+			(void) printf("\rBytes transferred: %lld\n", bytes);
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (c < 0)
04a9bc
@@ -755,7 +755,7 @@
04a9bc
 					hashbytes += HASHBYTES;
04a9bc
 				}
04a9bc
 				if (tick && (bytes >= hashbytes)) {
04a9bc
-					(void) printf("\rBytes transferred: %ld",
04a9bc
+					(void) printf("\rBytes transferred: %lld",
04a9bc
 						bytes);
04a9bc
 					(void) fflush(stdout);
04a9bc
 					while (bytes >= hashbytes)
04a9bc
@@ -780,7 +780,7 @@
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (tick) {
04a9bc
-			(void) printf("\rBytes transferred: %ld\n", bytes);
04a9bc
+			(void) printf("\rBytes transferred: %lld\n", bytes);
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (ferror(fin))
04a9bc
@@ -853,9 +853,9 @@
04a9bc
 	void (*volatile oldintp)(int);
04a9bc
 	void (*volatile oldintr)(int);
04a9bc
 	volatile int is_retr, tcrflag, bare_lfs = 0;
04a9bc
-	static unsigned bufsize;
04a9bc
+	static unsigned bufsize=0;
04a9bc
 	static char *buf;
04a9bc
-	volatile long bytes = 0, hashbytes = HASHBYTES;
04a9bc
+	volatile long long bytes = 0, hashbytes = HASHBYTES;
04a9bc
 	register int c, d;
04a9bc
 	struct timeval start, stop;
04a9bc
 	struct stat st;
04a9bc
@@ -1031,7 +1031,7 @@
04a9bc
 				(void) fflush(stdout);
04a9bc
 			}
04a9bc
 			if (tick && (bytes >= hashbytes) && is_retr) {
04a9bc
-				(void) printf("\rBytes transferred: %ld",
04a9bc
+				(void) printf("\rBytes transferred: %lld",
04a9bc
 					bytes);
04a9bc
 				(void) fflush(stdout);
04a9bc
 				while (bytes >= hashbytes)
04a9bc
@@ -1045,7 +1045,7 @@
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (tick && is_retr) {
04a9bc
-			(void) printf("\rBytes transferred: %ld\n", bytes);
04a9bc
+			(void) printf("\rBytes transferred: %lld\n", bytes);
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (c < 0) {
04a9bc
@@ -1095,7 +1095,7 @@
04a9bc
 					hashbytes += HASHBYTES;
04a9bc
 				}
04a9bc
 				if (tick && (bytes >= hashbytes) && is_retr) {
04a9bc
-					printf("\rBytes transferred: %ld",
04a9bc
+					printf("\rBytes transferred: %lld",
04a9bc
 						bytes);
04a9bc
 					fflush(stdout);
04a9bc
 					while (bytes >= hashbytes)
04a9bc
@@ -1126,7 +1126,7 @@
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (tick && is_retr) {
04a9bc
-			(void) printf("\rBytes transferred: %ld\n", bytes);
04a9bc
+			(void) printf("\rBytes transferred: %lld\n", bytes);
04a9bc
 			(void) fflush(stdout);
04a9bc
 		}
04a9bc
 		if (bare_lfs) {
04a9bc
@@ -1540,7 +1540,7 @@
04a9bc
 }
04a9bc
 
04a9bc
 static void
04a9bc
-ptransfer(const char *direction, long bytes, 
04a9bc
+ptransfer(const char *direction, long long bytes, 
04a9bc
 	  const struct timeval *t0, 
04a9bc
 	  const struct timeval *t1)
04a9bc
 {
04a9bc
@@ -1552,7 +1552,7 @@
04a9bc
 		s = td.tv_sec + (td.tv_usec / 1000000.);
04a9bc
 #define	nz(x)	((x) == 0 ? 1 : (x))
04a9bc
 		bs = bytes / nz(s);
04a9bc
-		printf("%ld bytes %s in %.3g secs (%.2g Kbytes/sec)\n",
04a9bc
+		printf("%lld bytes %s in %.3g secs (%.2g Kbytes/sec)\n",
04a9bc
 		    bytes, direction, s, bs / 1024.0);
04a9bc
 	}
04a9bc
 }