summary refs log tree commit diff
path: root/clients/cli/polkit-agent.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-03-26 23:25:23 +0100
committerMichael Biebl <biebl@debian.org>2019-03-26 23:25:23 +0100
commit9a6dcbf895f9da01768e64b73cec88c16157d91e (patch)
treea359958930d731e9f1b59344642e10754419fe84 /clients/cli/polkit-agent.c
parent964ae8cc391520440cf5aa13e2b9cc34850ea6c2 (diff)
New upstream version 1.16.0 upstream/1.16.0
Diffstat (limited to 'clients/cli/polkit-agent.c')
-rw-r--r--clients/cli/polkit-agent.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/clients/cli/polkit-agent.c b/clients/cli/polkit-agent.c
index 338f0b15..accb567f 100644
--- a/clients/cli/polkit-agent.c
+++ b/clients/cli/polkit-agent.c
@@ -22,7 +22,6 @@
 #include "polkit-agent.h"
 
 #include <stdio.h>
-#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 
@@ -40,24 +39,25 @@ polkit_request (NMPolkitListener *listener,
                 gboolean echo_on,
                 gpointer user_data)
 {
-	char *response, *tmp, *p;
+	NmCli *nmc = user_data;
 
 	g_print ("%s\n", message);
 	g_print ("(action_id: %s)\n", action_id);
 
 	/* Ask user for polkit authorization password */
 	if (user) {
+		gs_free char *tmp = NULL;
+		char *p;
+
 		/* chop of ": " if present */
 		tmp = g_strdup (request);
 		p = strrchr (tmp, ':');
-		if (p && !strcmp (p, ": "))
+		if (p && nm_streq (p, ": "))
 			*p = '\0';
-		response = nmc_readline_echo (echo_on, "%s (%s): ", tmp, user);
-		g_free (tmp);
-	} else
-		response = nmc_readline_echo (echo_on, "%s", request);
+		return nmc_readline_echo (&nmc->nmc_config, echo_on, "%s (%s): ", tmp, user);
+	}
 
-	return response;
+	return nmc_readline_echo (&nmc->nmc_config, echo_on, "%s", request);
 }
 
 static void