Skip to content

Commit b78a841

Browse files
eshaztridge
authored andcommitted
feat: validate compress threads option
1 parent f7a2b8a commit b78a841

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

options.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int sparse_files = 0;
8686
int preallocate_files = 0;
8787
int do_compression = 0;
8888
int do_compression_level = CLVL_NOT_SPECIFIED;
89-
int do_compression_threads = 0;
89+
int do_compression_threads = 0; /*n = 0 use rsync thread, n >= 1 spawn n threads for compression */
9090
int am_root = 0; /* 0 = normal, 1 = root, 2 = --super, -1 = --fake-super */
9191
int am_server = 0;
9292
int am_sender = 0;
@@ -755,10 +755,10 @@ static struct poptOption long_options[] = {
755755
{"compress-choice", 0, POPT_ARG_STRING, &compress_choice, 0, 0, 0 },
756756
{"zc", 0, POPT_ARG_STRING, &compress_choice, 0, 0, 0 },
757757
{"skip-compress", 0, POPT_ARG_STRING, &skip_compress, 0, 0, 0 },
758-
{"compress-threads", 0, POPT_ARG_INT, &do_compression_threads, 0, 0, 0 },
759-
{"zt", 0, POPT_ARG_INT, &do_compression_threads, 0, 0, 0 },
760758
{"compress-level", 0, POPT_ARG_INT, &do_compression_level, 0, 0, 0 },
761759
{"zl", 0, POPT_ARG_INT, &do_compression_level, 0, 0, 0 },
760+
{"compress-threads", 0, POPT_ARG_INT, &do_compression_threads, 0, 0, 0 },
761+
{"zt", 0, POPT_ARG_INT, &do_compression_threads, 0, 0, 0 },
762762
{0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 },
763763
{"progress", 0, POPT_ARG_VAL, &do_progress, 1, 0, 0 },
764764
{"no-progress", 0, POPT_ARG_VAL, &do_progress, 0, 0, 0 },
@@ -2009,6 +2009,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
20092009
create_refuse_error(refused_compress);
20102010
goto cleanup;
20112011
}
2012+
if (do_compression_threads < 0)
2013+
do_compression_threads = 0;
20122014
}
20132015

20142016
#ifdef HAVE_SETVBUF

0 commit comments

Comments
 (0)