提交 524b2197 编写于 作者: G Gao feng 提交者: Daniel P. Berrange

Free cmd in virNetDevVethDelete

Signed-off-by: NGao feng <gaofeng@cn.fujitsu.com>
上级 7dc1d4ab
......@@ -196,18 +196,24 @@ int virNetDevVethDelete(const char *veth)
{
virCommandPtr cmd = virCommandNewArgList("ip", "link", "del", veth, NULL);
int status;
int ret = -1;
if (virCommandRun(cmd, &status) < 0)
return -1;
goto cleanup;
if (status != 0) {
if (!virNetDevExists(veth)) {
VIR_DEBUG("Device %s already deleted (by kernel namespace cleanup)", veth);
return 0;
ret = 0;
goto cleanup;
}
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to delete veth device %s"), veth);
return -1;
goto cleanup;
}
return 0;
ret = 0;
cleanup:
virCommandFree(cmd);
return ret;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册