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

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