Skip to content

Commit

Permalink
cmirror: Allow explicit empty host
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
donald committed Oct 9, 2023
1 parent 3ba77c4 commit 5c21710
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5c21710

Please sign in to comment.