remote: Fix client crash when URI path is empty when using ssh

The parsed path in the URI may be NULL resulting into:

  $ virsh -c qemu+ssh:// list
  Segmentation fault (core dumped)

Introduced by 22d81ceb46
This commit is contained in:
Peter Krempa 2013-06-14 10:41:29 +02:00
parent 22d81ceb46
commit 7710d236b2

View File

@ -633,7 +633,7 @@ doRemoteOpen(virConnectPtr conn,
case trans_libssh2:
if (!sockname) {
/* Right now we don't support default session connections */
if (STREQ(conn->uri->path, "/session")) {
if (STREQ_NULLABLE(conn->uri->path, "/session")) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Connecting to session instance without "
"socket path is not supported by the libssh2 "
@ -710,7 +710,7 @@ doRemoteOpen(virConnectPtr conn,
if (!sockname) {
/* Right now we don't support default session connections */
if (STREQ(conn->uri->path, "/session")) {
if (STREQ_NULLABLE(conn->uri->path, "/session")) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Connecting to session instance without "
"socket path is not supported by the ssh "