From c60b7056b2750c6d8ff476d37cc2724b2bd15461 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Tue, 1 Mar 2005 05:49:11 +0000 Subject: [PATCH] A few improvements to the new check_for_hostspec() function. --- options.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/options.c b/options.c index ea35841a..8a02d4f7 100644 --- a/options.c +++ b/options.c @@ -1490,17 +1490,16 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr) if (*s == '[' && (p = strchr(s, ']')) != NULL) { s++; hostlen = p - s; - if (*p == ':') - *port_ptr = atoi(p+1); - else if (!*port_ptr) - *port_ptr = RSYNC_PORT; + if (p[1] == ':') + *port_ptr = atoi(p+2); } else { if ((p = strchr(s, ':')) != NULL) { hostlen = p - s; *port_ptr = atoi(p+1); - } else if (!*port_ptr) - *port_ptr = RSYNC_PORT; + } } + if (!*port_ptr) + *port_ptr = RSYNC_PORT; *host_ptr = new_array(char, hostlen + 1); strlcpy(*host_ptr, s, hostlen + 1); return path; @@ -1513,6 +1512,7 @@ char *check_for_hostspec(char *s, char **host_ptr, int *port_ptr) *p = ']'; if (not_host) return NULL; + p++; } else { if (!(p = strchr(s, ':'))) return NULL; -- 2.34.1