Renamed sum_table -> hash_table.
[rsync/rsync.git] / io.c
diff --git a/io.c b/io.c
index 0948416..475ac40 100644 (file)
--- a/io.c
+++ b/io.c
@@ -41,7 +41,6 @@
 
 extern int bwlimit;
 extern size_t bwlimit_writemax;
-extern int verbose;
 extern int io_timeout;
 extern int allowed_lull;
 extern int am_server;
@@ -949,6 +948,11 @@ int read_vstring(int f, char *buf, int bufsize)
 void read_sum_head(int f, struct sum_struct *sum)
 {
        sum->count = read_int(f);
+       if (sum->count < 0) {
+               rprintf(FERROR, "Invalid checksum count %ld [%s]\n",
+                       (long)sum->count, who_am_i());
+               exit_cleanup(RERR_PROTOCOL);
+       }
        sum->blength = read_int(f);
        if (sum->blength < 0 || sum->blength > MAX_BLOCK_SIZE) {
                rprintf(FERROR, "Invalid block length %ld [%s]\n",
@@ -1011,7 +1015,7 @@ static void sleep_for_bwlimit(int bytes_written)
 
 #define ONE_SEC        1000000L /* # of microseconds in a second */
 
-       if (!bwlimit)
+       if (!bwlimit_writemax)
                return;
 
        total_written += bytes_written; 
@@ -1091,7 +1095,7 @@ static void writefd_unbuffered(int fd,char *buf,size_t len)
                        continue;
 
                n = len - total;
-               if (bwlimit && n > bwlimit_writemax)
+               if (bwlimit_writemax && n > bwlimit_writemax)
                        n = bwlimit_writemax;
                cnt = write(fd, buf + total, n);