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

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