Skip to content
Permalink
Browse files

mirror: prepend ./ to rm and chmod arguments to avoid URL recognition (

…fix #452)
  • Loading branch information...
lavv17 committed Jul 31, 2018
1 parent 36d848b commit a27e07d90a4608ceaf928b1babb27d4d803e1992
Showing with 9 additions and 15 deletions.
  1. +9 −15 src/MirrorJob.cc
@@ -1164,35 +1164,29 @@ int MirrorJob::Do()
}
continue;
}
bool use_rmdir = (file->TypeIs(file->DIRECTORY)
&& recursion_mode==RECURSION_NEVER);
if(script)
{
ArgV args("rm");
if(file->TypeIs(file->DIRECTORY))
{
if(recursion_mode==RECURSION_NEVER)
args.setarg(0,"rmdir");
else
args.Append("-r");
}
ArgV args(use_rmdir?"rmdir":"rm");
if(file->TypeIs(file->DIRECTORY) && !use_rmdir)
args.Append("-r");
args.Append(target_session->GetFileURL(file->name));
xstring_ca cmd(args.CombineQuoted());
fprintf(script,"%s\n",cmd.get());
}
if(!script_only)
{
ArgV *args=new ArgV("rm");
args->Append(file->name);
ArgV *args=new ArgV(use_rmdir?"rmdir":"rm");
args->Append(dir_file(".",file->name));
args->seek(1);
rmJob *j=new rmJob(target_session->Clone(),args);
args->CombineTo(j->cmdline);
JobStarted(j);
if(file->TypeIs(file->DIRECTORY))
{
if(recursion_mode==RECURSION_NEVER)
{
args->setarg(0,"rmdir");
j->Rmdir();
}
else
j->Recurse();
}
@@ -1258,7 +1252,7 @@ int MirrorJob::Do()
if(!script_only)
{
ArgV *a=new ArgV("chmod");
a->Append(file->name);
a->Append(dir_file(".",file->name));
a->seek(1);
ChmodJob *cj=new ChmodJob(target_session->Clone(),
file->mode&~mode_mask,a);
@@ -1380,7 +1374,7 @@ int MirrorJob::Do()
if(!script_only)
{
ArgV *args=new ArgV("rm");
args->Append(file->name);
args->Append(dir_file(".",file->name));
args->seek(1);
rmJob *j=new rmJob(source_session->Clone(),args);
args->CombineTo(j->cmdline);

0 comments on commit a27e07d

Please sign in to comment.
You can’t perform that action at this time.