File: src-context-fix-library-reinitialization.patch

package info (click to toggle)
rauc 1.13-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,224 kB
  • sloc: ansic: 34,866; python: 2,435; sh: 1,364; xml: 53; makefile: 41
file content (46 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From c286b3587d13ad79275545606d32db800f587ceb Mon Sep 17 00:00:00 2001
From: Jan Luebbe <jlu@pengutronix.de>
Date: Tue, 15 Apr 2025 16:44:05 +0200
Subject: [PATCH 1/2] src/context: fix library reinitialization

In the test suite, we sometimes recreate the context, which caused
multiple initialization of the network and signature dependencies. With
OpenSSL 3.5, this leads to purpose ID collisions, as we try to add the
same purpose multiple times.

Avoid this by remembering if the have initialized our dependencies
already.

Fixes: 295fa3a50597 ("src/context.c: fully free context in r_context_clean()")
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Origin: https://github.com/rauc/rauc/pull/1697
---
 src/context.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/context.c b/src/context.c
index 1fb65e630249..3543a96a2b58 100644
--- a/src/context.c
+++ b/src/context.c
@@ -811,7 +811,9 @@ void r_context_register_progress_callback(progress_callback progress_cb)
 
 RaucContext *r_context_conf(void)
 {
-	if (context == NULL) {
+	static gboolean initialized = FALSE;
+
+	if (!initialized) {
 		GError *ierror = NULL;
 
 		// let us handle broken pipes explicitly
@@ -828,6 +830,10 @@ RaucContext *r_context_conf(void)
 			return NULL;
 		}
 
+		initialized = TRUE;
+	}
+
+	if (context == NULL) {
 		context = g_new0(RaucContext, 1);
 		context->progress = NULL;
 		context->install_info = g_new0(RContextInstallationInfo, 1);