X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/3dd22903ac6df765f6525f53fe98d9dfdd4ac5c4..0058c58edde4ed8c3829894218b5a595a26dea2f:/options.c diff --git a/options.c b/options.c index b783fcac..e11d20ea 100644 --- a/options.c +++ b/options.c @@ -290,6 +290,7 @@ void usage(enum logcode F) rprintf(F," --bwlimit=KBPS limit I/O bandwidth, KBytes per second\n"); rprintf(F," --write-batch=PREFIX write batch fileset starting with PREFIX\n"); rprintf(F," --read-batch=PREFIX read batch fileset starting with PREFIX\n"); + rprintf(F," --checksum-seed=NUM set block/file checksum seed\n"); #ifdef INET6 rprintf(F," -4 --ipv4 prefer IPv4\n"); rprintf(F," -6 --ipv6 prefer IPv6\n"); @@ -386,6 +387,7 @@ static struct poptOption long_options[] = { {"from0", '0', POPT_ARG_NONE, &eol_nulls, 0, 0, 0}, {"no-implied-dirs", 0, POPT_ARG_VAL, &implied_dirs, 0, 0, 0 }, {"protocol", 0, POPT_ARG_INT, &protocol_version, 0, 0, 0 }, + {"checksum-seed", 0, POPT_ARG_INT, &checksum_seed, 0, 0, 0 }, #ifdef INET6 {"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 }, {"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 }, @@ -394,7 +396,7 @@ static struct poptOption long_options[] = { }; -static char err_buf[100]; +static char err_buf[200]; /** @@ -404,15 +406,17 @@ static char err_buf[100]; **/ void option_error(void) { - if (err_buf[0]) { - rprintf(FLOG, "%s", err_buf); - rprintf(FERROR, RSYNC_NAME ": %s", err_buf); - } else { - rprintf (FERROR, "Error parsing options: " - "option may be supported on client but not on server?\n"); - rprintf (FERROR, RSYNC_NAME ": Error parsing options: " - "option may be supported on client but not on server?\n"); + int save_daemon = am_daemon; + + if (!err_buf[0]) { + strcpy(err_buf, "Error parsing options: " + "option may be supported on client but not on server?\n"); } + + rwrite(FLOG, err_buf, strlen(err_buf)); + am_daemon = 0; + rprintf(FERROR, RSYNC_NAME ": %s", err_buf); + am_daemon = save_daemon; } @@ -580,7 +584,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain) snprintf(err_buf, sizeof err_buf, "hard links are not supported on this %s\n", am_server ? "server" : "client"); - rprintf(FERROR, "ERROR: %s", err_buf); return 0; #endif @@ -613,7 +616,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain) snprintf(err_buf, sizeof err_buf, "symlinks are not supported on this %s\n", am_server ? "server" : "client"); - rprintf(FERROR, "ERROR: %s", err_buf); return 0; } #endif @@ -623,7 +625,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain) snprintf(err_buf, sizeof err_buf, "hard links are not supported on this %s\n", am_server ? "server" : "client"); - rprintf(FERROR, "ERROR: %s", err_buf); return 0; } #endif @@ -912,6 +913,12 @@ void server_options(char **args,int *argc) args[ac++] = arg; } + if (checksum_seed) { + if (asprintf(&arg, "--checksum-seed=%d", checksum_seed) < 0) + goto oom; + args[ac++] = arg; + } + if (keep_partial) args[ac++] = "--partial";