提交 a4aaed61 编写于 作者: F Fabiano Fidêncio

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

virGetUserDirectory() *never* *ever* returns NULL, making the checks for
it completely unnecessary.
Signed-off-by: NFabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 998cd537
...@@ -466,11 +466,9 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host, ...@@ -466,11 +466,9 @@ virNetClientPtr virNetClientNewLibSSH2(const char *host,
privkey = g_strdup(privkeyPath); privkey = g_strdup(privkeyPath);
} else { } else {
homedir = virGetUserDirectory(); homedir = virGetUserDirectory();
if (homedir) {
if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0) if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0)
goto no_memory; goto no_memory;
} }
}
if (!authMethods) { if (!authMethods) {
if (privkey) if (privkey)
...@@ -566,11 +564,9 @@ virNetClientPtr virNetClientNewLibssh(const char *host, ...@@ -566,11 +564,9 @@ virNetClientPtr virNetClientNewLibssh(const char *host,
privkey = g_strdup(privkeyPath); privkey = g_strdup(privkeyPath);
} else { } else {
homedir = virGetUserDirectory(); homedir = virGetUserDirectory();
if (homedir) {
if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0) if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0)
goto no_memory; goto no_memory;
} }
}
if (!authMethods) { if (!authMethods) {
if (privkey) if (privkey)
......
...@@ -805,9 +805,6 @@ static int virNetTLSContextLocateCredentials(const char *pkipath, ...@@ -805,9 +805,6 @@ static int virNetTLSContextLocateCredentials(const char *pkipath,
*/ */
userdir = virGetUserDirectory(); userdir = virGetUserDirectory();
if (!userdir)
goto error;
user_pki_path = g_strdup_printf("%s/.pki/libvirt", userdir); user_pki_path = g_strdup_printf("%s/.pki/libvirt", userdir);
VIR_DEBUG("Trying to find TLS user credentials in %s", user_pki_path); VIR_DEBUG("Trying to find TLS user credentials in %s", user_pki_path);
...@@ -864,15 +861,6 @@ static int virNetTLSContextLocateCredentials(const char *pkipath, ...@@ -864,15 +861,6 @@ static int virNetTLSContextLocateCredentials(const char *pkipath,
VIR_FREE(userdir); VIR_FREE(userdir);
return 0; return 0;
error:
VIR_FREE(*cacert);
VIR_FREE(*cacrl);
VIR_FREE(*key);
VIR_FREE(*cert);
VIR_FREE(user_pki_path);
VIR_FREE(userdir);
return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册