aboutsummaryrefslogtreecommitdiffstats
path: root/src/runtime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime.c')
-rw-r--r--src/runtime.c11
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;
}