Commit 57cf564a authored by Antoine Beaupré's avatar Antoine Beaupré

remove recursive mkdir code

place the escapeshellarg() calls properly
print the cp error on failure
assume the target parent directory
parent ed74b4de
......@@ -522,23 +522,16 @@ class m_bro {
// Last step // Copy -R
$src = $this->convertabsolute($src);
$dest = $this->convertabsolute($dest);
$src = escapeshellarg($src);
$dest = escapeshellarg($dest);
if (!$src || !$dest) {
$err->raise("bro",1);
return false;
}
/* XXX: UNIX-specific because of that slash */
$array = explode('/', $dest);
$dir = "";
foreach ($array as $v) {
$dir .= "$v/";
@mkdir($dest);
}
#TODO write a recursive copy function(?)
exec("cp -Rpf '$src'/* '$dest'", $void, $ret);
$src = escapeshellarg($src);
$dest = escapeshellarg($dest);
// TODO: write a recursive copy function(?)
exec("cp -Rpf '$src' '$dest'", $void, $ret);
if ($ret) {
$err->raise("bro","Errors happened while copying the source to destination.");
$err->raise("bro","Errors happened while copying the source to destination. cp return value: %d", $ret);
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment