virGetUserDirectory() *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>
privkey = g_strdup(privkeyPath);
} else {
homedir = virGetUserDirectory();
- if (homedir) {
- if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0)
- goto no_memory;
- }
+ if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0)
+ goto no_memory;
}
if (!authMethods) {
privkey = g_strdup(privkeyPath);
} else {
homedir = virGetUserDirectory();
- if (homedir) {
- if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0)
- goto no_memory;
- }
+ if (virNetClientFindDefaultSshKey(homedir, &privkey) < 0)
+ goto no_memory;
}
if (!authMethods) {
*/
userdir = virGetUserDirectory();
- if (!userdir)
- goto error;
-
user_pki_path = g_strdup_printf("%s/.pki/libvirt", userdir);
VIR_DEBUG("Trying to find TLS user credentials in %s", user_pki_path);
VIR_FREE(userdir);
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;
}