From 5c21710953c9b0ec099d81d6659caad1ce7f839e Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Mon, 9 Oct 2023 14:02:52 +0200 Subject: [PATCH] cmirror: Allow explicit empty host Currently, a local copy with a destination containing ":" doesn't work, because `cmirror src /tmp/c:d` would try to use "/tmp/c" as a hostname and `cmirror src :/tmp/c:d` would use ":/tmp/c:d" as a (local) destination. Allow explicit empty hostname, so that the second form can be used to specify a local destination with ":" in the path. --- cmirror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmirror.c b/cmirror.c index bca9caa..b1711ec 100644 --- a/cmirror.c +++ b/cmirror.c @@ -1104,7 +1104,7 @@ static void master(char *master_path, char *target) { LOCAL_DEV = g_hash_table_new_full(g_int64_hash, g_int64_equal, g_free, NULL); { - g_auto(GStrv) match1 = MATCH_RE("^([^:]+):(.+)$", target); // system:/path + g_auto(GStrv) match1 = MATCH_RE("^([^:]*):(.+)$", target); // system:/path if (match1) { slave_path = STEAL_POINTER(&(match1[2])); g_auto(GStrv) match2 = MATCH_RE("^([^@]+)@(.+)$", match1[1]); // user@system