@@ -2256,8 +2256,9 @@ static bool
cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom = NULL;
- const char *dest = NULL;
+ const char *dest_cli = NULL;
const char *format = NULL;
+ char *dest = NULL;
unsigned long bandwidth = 0;
unsigned int granularity = 0;
unsigned long long buf_size = 0;
@@ -2281,7 +2282,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)
return false;
- if (vshCommandOptStringReq(ctl, cmd, "dest", &dest) < 0)
+ if (vshCommandOptStringReq(ctl, cmd, "dest", &dest_cli) < 0)
return false;
if (vshCommandOptStringReq(ctl, cmd, "xml", &xml) < 0)
return false;
@@ -2308,6 +2309,11 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
if (async)
abort_flags |= VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC;
+ if (dest_cli && virFileAbsPath(dest_cli, &dest) < 0) {
+ vshError(ctl, _("failed to build absolute path for %s"), dest_cli);
+ return false;
+ }
+
VSH_EXCLUSIVE_OPTIONS_VAR(dest, xml);
VSH_EXCLUSIVE_OPTIONS_VAR(format, xml);
VSH_EXCLUSIVE_OPTIONS_VAR(blockdev, xml);
@@ -2462,6 +2468,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd)
ret = true;
cleanup:
+ VIR_FREE(dest);
VIR_FREE(xmlstr);
virTypedParamsFree(params, nparams);
virDomainFree(dom);