diff options
| author | 2024-01-09 04:27:18 -0600 | |
|---|---|---|
| committer | 2024-01-09 04:27:18 -0600 | |
| commit | 82ceaa4680ee1a626effb6008ba605a10da07468 (patch) | |
| tree | 90fff79a9857be692fd7a991f97660b672b8129c /src/runtime.c | |
| parent | finish the runtime stuff (buggy maybe) (diff) | |
actually use runtime
Diffstat (limited to 'src/runtime.c')
| -rw-r--r-- | src/runtime.c | 11 |
1 files changed, 7 insertions, 4 deletions
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; } |
