rpc: Don't check the output of virGetUserConfigDirectory()

virGetUserConfigDirectory() *never* *ever* returns NULL, making the
checks for it completely unnecessary.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-12-19 09:37:51 +01:00
parent 2db0583c73
commit 964482aec2

View File

@ -455,11 +455,9 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
knownhosts = g_strdup(knownHostsPath); knownhosts = g_strdup(knownHostsPath);
} else { } else {
confdir = virGetUserConfigDirectory(); confdir = virGetUserConfigDirectory();
if (confdir) { virBufferAsprintf(&buf, "%s/known_hosts", confdir);
virBufferAsprintf(&buf, "%s/known_hosts", confdir); if (!(knownhosts = virBufferContentAndReset(&buf)))
if (!(knownhosts = virBufferContentAndReset(&buf))) goto no_memory;
goto no_memory;
}
} }
if (privkeyPath) { if (privkeyPath) {
@ -556,8 +554,7 @@ virNetClientPtr virNetClientNewLibssh(const char *host,
knownhosts = g_strdup(knownHostsPath); knownhosts = g_strdup(knownHostsPath);
} else { } else {
confdir = virGetUserConfigDirectory(); confdir = virGetUserConfigDirectory();
if (confdir) knownhosts = g_strdup_printf("%s/known_hosts", confdir);
knownhosts = g_strdup_printf("%s/known_hosts", confdir);
} }
if (privkeyPath) { if (privkeyPath) {