提交 9fbefc54 编写于 作者: D Dmitry Guryanov 提交者: Daniel Veillard

parallels: cleanup parallelsOpen and fix error message

Do some cleanup of parallelsOpen, STREQ_NULLABLE can replace
a lot of checks.

Also fix error message to be VIR_ERR_INTERNAL_ERROR, the same
as in other drivers.
Signed-off-by: NDmitry Guryanov <dguryanov@parallels.com>
上级 4aaa5a72
......@@ -664,21 +664,14 @@ parallelsOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED;
/* From this point on, the connection is for us. */
if (
conn->uri->path[0] == '\0' ||
(conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
_("parallelsOpen: supply a path or use "
"parallels:///system"));
if (!STREQ_NULLABLE(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected Parallels URI path '%s', try parallels:///system"),
conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
if (STREQ(conn->uri->path, "/system"))
ret = parallelsOpenDefault(conn);
else
return VIR_DRV_OPEN_DECLINED;
if (ret != VIR_DRV_OPEN_SUCCESS)
if ((ret = parallelsOpenDefault(conn)) != VIR_DRV_OPEN_SUCCESS)
return ret;
return VIR_DRV_OPEN_SUCCESS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册