Skip to content

Commit 8816c9a

Browse files
TheoTechnicguytridge
authored andcommitted
feat: insert -- between RSH and rsync commands
Nowadays, CLI program options not always support single-dash syntax and do not require flags to be set before positional arguments. To ensure that future remote shells do not interpret rsync flags, this commit inserts a double dash (`--`) before the transmitted rsync command.
1 parent 1c5ebdc commit 8816c9a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,10 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in
586586
args[argc++] = machine;
587587
#endif
588588

589+
// include a `--` before any rsync commands to indicate that
590+
// all following arguments are intended as positional
591+
// and should not be parsed by the shell
592+
args[argc++] = "--";
589593
args[argc++] = rsync_path;
590594

591595
if (blocking_io < 0 && (strcmp(t, "rsh") == 0 || strcmp(t, "remsh") == 0))

0 commit comments

Comments
 (0)