Allow --max-alloc=0 for unlimited.
authorWayne Davison <wayne@opencoder.net>
Tue, 7 Jul 2020 18:56:23 +0000 (11:56 -0700)
committerWayne Davison <wayne@opencoder.net>
Tue, 7 Jul 2020 18:56:23 +0000 (11:56 -0700)
options.c
rsync.1.md
t_stub.c
util2.c

index 0b7b9f33e8a1a0854c65bba1253de30011593590..83146eefab07489d83d4f979e94d3ff3d26b466f 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1889,7 +1889,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                        max_alloc_arg = NULL;
        }
        if (max_alloc_arg) {
-               ssize_t size = parse_size_arg(max_alloc_arg, 'B', "max-alloc", 1024*1024, False);
+               ssize_t size = parse_size_arg(max_alloc_arg, 'B', "max-alloc", 1024*1024, True);
                if (size < 0)
                        return 0;
                max_alloc = size;
index 76b55367027e5fc5e4715e64ef1a4fe97967c396..3c8567425058daadea66c2a771bee96a04209126 100644 (file)
@@ -1741,7 +1741,8 @@ your home directory (remove the '=' for that).
     letters can be any mix of upper and lower-case that you want to use.
 
     Finally, if the string ends with either "+1" or "-1", it is offset by one
-    byte in the indicated direction.  The largest possible value is `8192P-1`.
+    byte in the indicated direction.  The largest possible value is usually
+    `8192P-1`.
 
     Examples: `--max-size=1.5mb-1` is 1499999 bytes, and `--max-size=2g+1` is
     2147483649 bytes.
@@ -1772,6 +1773,8 @@ your home directory (remove the '=' for that).
     See the `--max-size` option for a description of how SIZE can be specified.
     The default suffix if none is given is bytes.
 
+    Beginning in 3.2.3, a value of 0 specifies no limit.
+
     You can set a default value using the environment variable RSYNC_MAX_ALLOC
     using the same SIZE values as supported by this option.  If the remote
     rsync doesn't understand the `--max-alloc` option, you can override an
@@ -3089,7 +3092,7 @@ your home directory (remove the '=' for that).
     fractional value (e.g. "`--bwlimit=1.5m`").  If no suffix is specified, the
     value will be assumed to be in units of 1024 bytes (as if "K" or "KiB" had
     been appended).  See the `--max-size` option for a description of all the
-    available suffixes.  A value of zero specifies no limit.
+    available suffixes.  A value of 0 specifies no limit.
 
     For backward-compatibility reasons, the rate limit will be rounded to the
     nearest KiB unit, so no rate smaller than 1024 bytes per second is
index 954b86da7e43241969649b6877481b3d08f51a3a..1e1e40462430e6be8ae6e8a3b55e16110503fdba 100644 (file)
--- a/t_stub.c
+++ b/t_stub.c
@@ -33,7 +33,7 @@ int preserve_xattrs = 0;
 int preserve_perms = 0;
 int preserve_executability = 0;
 int open_noatime = 0;
-size_t max_alloc = 1024*1024*1024; /* max_alloc is needed when combined with util2.o */
+size_t max_alloc = 0; /* max_alloc is needed when combined with util2.o */
 char *partial_dir;
 char *module_dir;
 filter_rule_list daemon_filter_list;
diff --git a/util2.c b/util2.c
index 181dbd7d3424e7a31ff29cf35818ad5db2b9da0f..e7c70c1fb3f899dcc85dc9685367608000d53703 100644 (file)
--- a/util2.c
+++ b/util2.c
@@ -86,7 +86,7 @@ char *num_to_byte_string(ssize_t num)
 
 void *my_alloc(void *ptr, size_t num, size_t size, const char *file, int line)
 {
-       if (num >= max_alloc/size) {
+       if (max_alloc && num >= max_alloc/size) {
                if (!file)
                        return NULL;
                rprintf(FERROR, "[%s] exceeded --max-alloc=%s setting (file=%s, line=%d)\n",