summaryrefslogtreecommitdiff
path: root/clients/cli/agent.c
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2018-01-23 14:49:15 +0100
committerLubomir Rintel <lkundrak@v3.sk>2018-01-24 09:53:38 +0100
commit7e8a84ae10c4868f299e136f183c0f574bb907e1 (patch)
tree75ff79ca64b0746a283ee7bf22c97d082e9c9299 /clients/cli/agent.c
parentfc4552d3912f2fc99690c6d0c08cb7f16c6d336f (diff)
downloadNetworkManager-7e8a84ae10c4868f299e136f183c0f574bb907e1.tar.gz
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.
Diffstat (limited to 'clients/cli/agent.c')
-rw-r--r--clients/cli/agent.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/clients/cli/agent.c b/clients/cli/agent.c
index 2088648aa0..46725c94f3 100644
--- a/clients/cli/agent.c
+++ b/clients/cli/agent.c
@@ -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;