nmcli/agent: fix handling of polkit agent failure

On "nmcli agent all", when the polkit agent fails (while the NM agent
succeeds), the failure is not communicated until the client exits.
This commit is contained in:
Lubomir Rintel 2018-01-23 14:49:15 +01:00
parent fc4552d391
commit 7e8a84ae10

View file

@ -201,10 +201,16 @@ do_agent_all (NmCli *nmc, int argc, char **argv)
/* Run both secret and polkit agent */
secret_res = do_agent_secret (nmc, argc, argv);
if (secret_res != NMC_RESULT_SUCCESS)
if (secret_res != NMC_RESULT_SUCCESS) {
g_printerr ("%s\n", nmc->return_text->str);
g_string_truncate (nmc->return_text, 0);
}
nmc->return_value = do_agent_polkit (nmc, argc, argv);
if (nmc->return_value != NMC_RESULT_SUCCESS) {
g_printerr ("%s\n", nmc->return_text->str);
g_string_truncate (nmc->return_text, 0);
}
if (nmc->return_value == NMC_RESULT_SUCCESS && secret_res != NMC_RESULT_SUCCESS)
nmc->return_value = secret_res;