mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
remote: use g_autofree and remove unnecessary label
Signed-off-by: Jiang Jiacheng <jiangjiacheng@huawei.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
075cfd842e
commit
ef36cc5058
@ -3841,23 +3841,19 @@ struct remoteAuthInteractState {
|
|||||||
static int remoteAuthFillFromConfig(virConnectPtr conn,
|
static int remoteAuthFillFromConfig(virConnectPtr conn,
|
||||||
struct remoteAuthInteractState *state)
|
struct remoteAuthInteractState *state)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
int ninteract;
|
int ninteract;
|
||||||
const char *credname;
|
const char *credname;
|
||||||
char *path = NULL;
|
g_autofree char *path = NULL;
|
||||||
|
|
||||||
VIR_DEBUG("Trying to fill auth parameters from config file");
|
VIR_DEBUG("Trying to fill auth parameters from config file");
|
||||||
|
|
||||||
if (!state->config) {
|
if (!state->config) {
|
||||||
if (virAuthGetConfigFilePath(conn, &path) < 0)
|
if (virAuthGetConfigFilePath(conn, &path) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
if (path == NULL) {
|
if (path == NULL)
|
||||||
ret = 0;
|
return 0;
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(state->config = virAuthConfigNew(path)))
|
if (!(state->config = virAuthConfigNew(path)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ninteract = 0; state->interact[ninteract].id != 0; ninteract++) {
|
for (ninteract = 0; state->interact[ninteract].id != 0; ninteract++) {
|
||||||
@ -3887,7 +3883,7 @@ static int remoteAuthFillFromConfig(virConnectPtr conn,
|
|||||||
VIR_URI_SERVER(conn->uri),
|
VIR_URI_SERVER(conn->uri),
|
||||||
credname,
|
credname,
|
||||||
&value) < 0)
|
&value) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
state->interact[ninteract].result = value;
|
state->interact[ninteract].result = value;
|
||||||
@ -3895,11 +3891,7 @@ static int remoteAuthFillFromConfig(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
VIR_FREE(path);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user