Commit 9510fa9a authored by Wayne Davison's avatar Wayne Davison

Allow --max-size=0 and --min-size=0.

Fixes bug 7965.
parent d74512eb
......@@ -1602,7 +1602,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
if (max_size > 0 && F_LENGTH(file) > max_size) {
if (max_size >= 0 && F_LENGTH(file) > max_size) {
if (INFO_GTE(SKIP, 1)) {
if (solo_file)
fname = f_name(file, NULL);
......@@ -1610,7 +1610,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
goto cleanup;
}
if (min_size > 0 && F_LENGTH(file) < min_size) {
if (min_size >= 0 && F_LENGTH(file) < min_size) {
if (INFO_GTE(SKIP, 1)) {
if (solo_file)
fname = f_name(file, NULL);
......@@ -2062,9 +2062,11 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
#endif
if (check_redo && (ndx = get_redo_num()) != -1) {
OFF_T save_max_size = max_size;
OFF_T save_min_size = min_size;
csum_length = SUM_LENGTH;
max_size = -max_size;
min_size = -min_size;
max_size = -1;
min_size = -1;
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
......@@ -2088,8 +2090,8 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
cur_flist = flist;
csum_length = SHORT_SUM_LENGTH;
max_size = -max_size;
min_size = -min_size;
max_size = save_max_size;
min_size = save_min_size;
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
......
......@@ -114,8 +114,8 @@ int ignore_existing = 0;
int ignore_non_existing = 0;
int need_messages_from_generator = 0;
int max_delete = INT_MIN;
OFF_T max_size = 0;
OFF_T min_size = 0;
OFF_T max_size = -1;
OFF_T min_size = -1;
int ignore_errors = 0;
int modify_window = 0;
int blocking_io = -1;
......@@ -1590,7 +1590,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
break;
case OPT_MAX_SIZE:
if ((max_size = parse_size_arg(&max_size_arg, 'b')) <= 0) {
if ((max_size = parse_size_arg(&max_size_arg, 'b')) < 0) {
snprintf(err_buf, sizeof err_buf,
"--max-size value is invalid: %s\n",
max_size_arg);
......@@ -1599,7 +1599,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
break;
case OPT_MIN_SIZE:
if ((min_size = parse_size_arg(&min_size_arg, 'b')) <= 0) {
if ((min_size = parse_size_arg(&min_size_arg, 'b')) < 0) {
snprintf(err_buf, sizeof err_buf,
"--min-size value is invalid: %s\n",
min_size_arg);
......@@ -2545,11 +2545,11 @@ void server_options(char **args, int *argc_p)
args[ac++] = arg;
} else if (max_delete == 0)
args[ac++] = "--max-delete=-1";
if (min_size) {
if (min_size >= 0) {
args[ac++] = "--min-size";
args[ac++] = min_size_arg;
}
if (max_size) {
if (max_size >= 0) {
args[ac++] = "--max-size";
args[ac++] = max_size_arg;
}
......
......@@ -1448,11 +1448,15 @@ be offset by one byte in the indicated direction.
Examples: --max-size=1.5mb-1 is 1499999 bytes, and --max-size=2g+1 is
2147483649 bytes.
Note that rsync versions prior to 3.1.0 did not allow bf(--max-size=0).
dit(bf(--min-size=SIZE)) This tells rsync to avoid transferring any
file that is smaller than the specified SIZE, which can help in not
transferring small, junk files.
See the bf(--max-size) option for a description of SIZE and other information.
Note that rsync versions prior to 3.1.0 did not allow bf(--min-size=0).
dit(bf(-B, --block-size=BLOCKSIZE)) This forces the block size used in
rsync's delta-transfer algorithm to a fixed value. It is normally selected based on
the size of each file being updated. See the technical report for details.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment