All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] client: Consolidate cancelation replies
@ 2019-10-25 20:32 Tim Kourt
  2019-10-25 20:32 ` [PATCH 2/5] client: Modify error handler to return cancelation msg Tim Kourt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tim Kourt @ 2019-10-25 20:32 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

---
 client/agent.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/client/agent.c b/client/agent.c
index 8af714a2..b80e5727 100644
--- a/client/agent.c
+++ b/client/agent.c
@@ -50,6 +50,15 @@ static struct pending_op {
 	struct l_queue *saved_input;
 } pending_op;
 
+static struct l_dbus_message *agent_reply_canceled(
+						struct l_dbus_message *message,
+						const char *text)
+{
+	return l_dbus_message_new_error(message,
+					IWD_AGENT_INTERFACE ".Error.Canceled",
+					"Error: %s", text);
+}
+
 static struct l_dbus_message *agent_error(const char *text)
 {
 	display_error(text);
@@ -342,9 +351,8 @@ static void process_input_username_password(const char *prompt)
 	if (l_queue_isempty(pending_op.saved_input)) {
 		/* received username */
 		if (!strlen(prompt)) {
-			reply = l_dbus_message_new_error(pending_message,
-					IWD_AGENT_INTERFACE ".Error.Canceled",
-					"Canceled by user");
+			reply = agent_reply_canceled(pending_message,
+							"Canceled by user");
 			goto send_reply;
 		}
 
@@ -372,9 +380,8 @@ static void process_input_passphrase(const char *prompt)
 	struct l_dbus_message *reply;
 
 	if (!strlen(prompt)) {
-		reply = l_dbus_message_new_error(pending_message,
-					IWD_AGENT_INTERFACE ".Error.Canceled",
-					"Canceled by user");
+		reply = agent_reply_canceled(pending_message,
+							"Canceled by user");
 		goto send_reply;
 	}
 
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-28 15:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-25 20:32 [PATCH 1/5] client: Consolidate cancelation replies Tim Kourt
2019-10-25 20:32 ` [PATCH 2/5] client: Modify error handler to return cancelation msg Tim Kourt
2019-10-25 20:32 ` [PATCH 3/5] client: Respond to invalid agent requests Tim Kourt
2019-10-25 20:32 ` [PATCH 4/5] client: Fail on requests with invalid arguments Tim Kourt
2019-10-25 20:32 ` [PATCH 5/5] doc: Update agent API with possible errors Tim Kourt
2019-10-28 15:49 ` [PATCH 1/5] client: Consolidate cancelation replies Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.