Blame SOURCES/netkit-ftp-0.17-longint.patch

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