{
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
- if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
+ if (STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected bhyve URI path '%s', try bhyve:///system"),
conn->uri->path);
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
if (STRCASENEQ(conn->uri->scheme, "vpx") &&
- conn->uri->path && STRNEQ(conn->uri->path, "/")) {
+ STRNEQ(conn->uri->path, "/")) {
VIR_WARN("Ignoring unexpected path '%s' for non-vpx scheme '%s'",
conn->uri->path, conn->uri->scheme);
}
goto failed;
}
+ /* Avoid need for drivers to worry about NULLs, as
+ * no one needs to distinguish "" vs NULL */
+ if (ret->uri->path == NULL &&
+ VIR_STRDUP(ret->uri->path, "") < 0)
+ goto failed;
+
VIR_DEBUG("Split \"%s\" to URI components:\n"
" scheme %s\n"
" server %s\n"
uristr,
NULLSTR(ret->uri->scheme), NULLSTR(ret->uri->server),
NULLSTR(ret->uri->user), ret->uri->port,
- NULLSTR(ret->uri->path));
+ ret->uri->path);
if (ret->uri->scheme == NULL) {
virReportError(VIR_ERR_NO_CONNECT,
}
/* /session isn't supported in libxenlight */
- if (conn->uri->path &&
- STRNEQ(conn->uri->path, "") &&
+ if (STRNEQ(conn->uri->path, "") &&
STRNEQ(conn->uri->path, "/") &&
STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected Xen URI path '%s', try xen:///system"),
- NULLSTR(conn->uri->path));
+ conn->uri->path);
return VIR_DRV_OPEN_ERROR;
}
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
/* If path isn't '/' then they typoed, tell them correct path */
- if (conn->uri->path != NULL &&
- STRNEQ(conn->uri->path, "/") &&
+ if (STRNEQ(conn->uri->path, "/") &&
STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected LXC URI path '%s', try lxc:///system"),
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
/* If path isn't /system, then they typoed, so tell them correct path */
- if (conn->uri->path == NULL ||
- STRNEQ(conn->uri->path, "/system")) {
+ if (STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected OpenVZ URI path '%s', try openvz:///system"),
conn->uri->path);
if (VIR_ALLOC(uuid_table) < 0)
goto failure;
- if (conn->uri->path) {
+ if (conn->uri->path[0] != '\0') {
/* need to shift one byte in order to remove the first "/" of URI component */
if (VIR_STRDUP(managed_system,
conn->uri->path + (conn->uri->path[0] == '/')) < 0)
}
cfg = virQEMUDriverGetConfig(qemu_driver);
- if (conn->uri->path == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("no QEMU URI path given, try %s"),
- cfg->uri);
- goto cleanup;
- }
if (virQEMUDriverIsPrivileged(qemu_driver)) {
if (STRNEQ(conn->uri->path, "/system") &&
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
- if (!conn->uri->path
- || conn->uri->path[0] == '\0'
- || (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) {
+ if (conn->uri->path[0] == '\0' ||
+ (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) {
virReportError(VIR_ERR_INVALID_ARG,
"%s", _("testOpen: supply a path or use test:///default"));
return VIR_DRV_OPEN_ERROR;
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
- if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("no VirtualBox driver path specified (try vbox:///session)"));
- return VIR_DRV_OPEN_ERROR;
- }
-
if (uid != 0) {
if (STRNEQ(conn->uri->path, "/session")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
- if (conn->uri->path == NULL || STREQ(conn->uri->path, "")) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("no VirtualBox driver path specified (try vbox:///session)"));
- return VIR_DRV_OPEN_ERROR;
- }
-
if (uid != 0) {
if (STRNEQ(conn->uri->path, "/session")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
/* If path isn't /session, then they typoed, so tell them correct path */
- if (conn->uri->path == NULL || STRNEQ(conn->uri->path, "/session")) {
+ if (STRNEQ(conn->uri->path, "/session")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected VMware URI path '%s', try vmwareplayer:///session, vmwarews:///session or vmwarefusion:///session"),
NULLSTR(conn->uri->path));
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
/* From this point on, the connection is for us. */
- if (STRNEQ_NULLABLE(conn->uri->path, "/system")) {
+ if (STRNEQ(conn->uri->path, "/system")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected Virtuozzo URI path '%s', try vz:///system"),
conn->uri->path);