From 7ed512bd92121dcc4a1233b0d96e45ab27585fec Mon Sep 17 00:00:00 2001 From: stratosnn Date: Tue, 8 Dec 2020 16:22:47 +0100 Subject: [PATCH 1/2] Allow messages to flow into progress IPC There seems to be an error in the version we are using: Free text messages are not passed via swupdate progress API interface. This seems to be later corrected here : https://github.com/sbabic/swupdate/commit/c20be59935cc77373756afc45628dcb0cae36100 by adding yet another listener and new message status `PROGRESS`. However in our case we probably want to receive all messages that swupdate daemon emits. Alternatively we can limit it to essentials only. --- core/notifier.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/core/notifier.c b/core/notifier.c index 8643c6f0d..6c8a4c0c8 100644 --- a/core/notifier.c +++ b/core/notifier.c @@ -189,10 +189,6 @@ static void process_notifier (RECOVERY_STATUS status, int event, int level, cons { (void)level; - /* Check just in case a process want to send an info outside */ - if (status != SUBPROCESS) - return; - switch (event) { case (CANCELUPDATE): status = FAILURE; From 645915927fc7228ee32f688744eac3b886946c4d Mon Sep 17 00:00:00 2001 From: stratosnn Date: Tue, 8 Dec 2020 20:08:42 +0100 Subject: [PATCH 2/2] Encapsulate JSON correctly in swupdate_progress_info --- corelib/progress_thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/corelib/progress_thread.c b/corelib/progress_thread.c index 535ed4c96..5cd3bb361 100644 --- a/corelib/progress_thread.c +++ b/corelib/progress_thread.c @@ -149,7 +149,7 @@ void swupdate_progress_info(RECOVERY_STATUS status, int cause, const char *info) { struct swupdate_progress *prbar = &progress; pthread_mutex_lock(&prbar->lock); - snprintf(prbar->msg.info, sizeof(prbar->msg.info), "{\"%d\": %s}", + snprintf(prbar->msg.info, sizeof(prbar->msg.info), "{\"%d\": \"%s\"}", cause, info); prbar->msg.infolen = strlen(prbar->msg.info); prbar->msg.status = status;