From 82ceaa4680ee1a626effb6008ba605a10da07468 Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Tue, 9 Jan 2024 04:27:18 -0600 Subject: actually use runtime --- src/runtime.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/runtime.c') diff --git a/src/runtime.c b/src/runtime.c index b811519..f40d97d 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -366,7 +366,7 @@ int l2_runtime__check_runtime_ftw(const char *fpath, const struct stat *sb, int int l2_runtime__ensure_runtime_files(const char *basepath, json_t *jfiles); -int l2_runtime_install_component(json_t *manifest, const char *component) +int l2_runtime_install_component(json_t *manifest, const char *component, char **ojrepath) { json_t *jrtcomps; if (json_unpack(manifest, "{s:{s:o}}", L2SU_JRE_ARCH, component, &jrtcomps) < 0) { @@ -407,9 +407,10 @@ int l2_runtime_install_component(json_t *manifest, const char *component) } } - char *jrepath; - size_t jrepathlen; - L2_ASPRINTF(jrepath, jrepathlen, "%s/runtime/%s/%s", l2_state.paths.data, L2SU_JRE_ARCH, component); + char *jrepath = l2_launcher_sprintf_alloc("%s/runtime/%s/%s", l2_state.paths.data, L2SU_JRE_ARCH, component); + if (!jrepath) { + goto cleanup; + } errno = 0; if (l2_launcher_mkdir_parents(jrepath) < 0) { @@ -435,10 +436,12 @@ int l2_runtime_install_component(json_t *manifest, const char *component) goto cleanup; } + *ojrepath = jrepath; json_decref(jcompmanifest); return 0; cleanup: + free(jrepath); if (jcompmanifest) json_decref(jcompmanifest); return -1; } -- cgit v1.2.3-70-g09d2