From: Dmitry Guryanov Date: Mon, 13 Aug 2012 15:50:13 +0000 (+0400) Subject: parallels: cleanup parallelsOpen and fix error message X-Git-Tag: v0.10.0-rc1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fbefc540d258640ad5bf9587432291fe5440f72;p=thirdparty%2Flibvirt.git 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: Dmitry Guryanov --- diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index b5e0791122..06a75b353d 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -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;