X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/58cf354711f9e7eb2ec2a54b5f623abb860dafcf..dc6fb11b41daf37f1d47acde51b2a088e2892d0c:/options.c diff --git a/options.c b/options.c index 0c64eaa1..5f8018fe 100644 --- a/options.c +++ b/options.c @@ -2368,9 +2368,6 @@ void server_options(char **args, int *argc_p) if (protect_args && !local_server) /* unprotected args stop here */ args[ac++] = NULL; - if (do_stats) - args[ac++] = "--stats"; - if (list_only > 1) args[ac++] = "--list-only"; @@ -2472,6 +2469,8 @@ void server_options(char **args, int *argc_p) args[ac++] = "--super"; if (size_only) args[ac++] = "--size-only"; + if (do_stats) + args[ac++] = "--stats"; } else { if (skip_compress) { if (asprintf(&arg, "--skip-compress=%s", skip_compress) < 0) @@ -2626,17 +2625,18 @@ void server_options(char **args, int *argc_p) * (required for parsing) [ and ] chars elided from the returned string. */ static char *parse_hostspec(char *str, char **path_start_ptr, int *port_ptr) { - char *s = str; - char *host_start = str; + char *s, *host_start = str; int hostlen = 0, userlen = 0; char *ret; - for ( ; ; s++) { + for (s = str; ; s++) { if (!*s) { /* It is only OK if we run out of string with rsync:// */ - if (port_ptr) - break; - return NULL; + if (!port_ptr) + return NULL; + if (!hostlen) + hostlen = s - host_start; + break; } if (*s == ':' || *s == '/') { if (!hostlen) @@ -2647,7 +2647,7 @@ static char *parse_hostspec(char *str, char **path_start_ptr, int *port_ptr) } else if (port_ptr) { *port_ptr = atoi(s); while (isDigit(s)) s++; - if (*s++ != '/') + if (*s && *s++ != '/') return NULL; } break;