From 3d46909139241ec2d8982a4b2881cb33a8544414 Mon Sep 17 00:00:00 2001 From: Pablo Marcos Oltra Date: Fri, 5 Jan 2018 19:42:40 +0100 Subject: [PATCH] Append old LD_PRELOAD --- checkrt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/checkrt.c b/checkrt.c index a105f5f..f7a9222 100644 --- a/checkrt.c +++ b/checkrt.c @@ -103,8 +103,10 @@ void checkrt(char *usr_in_appdir) bundle_gcc = 1; if (bundle_cxx == 1 || bundle_gcc == 1) { - optional_ld_preload = malloc(strlen(EXEC_SO) + 13 + len); - sprintf(optional_ld_preload, "LD_PRELOAD=%s/" EXEC_SO, usr_in_appdir); + char *old_ld_preload = getenv("LD_PRELOAD"); + optional_ld_preload = malloc(strlen(EXEC_SO) + (old_ld_preload ? 1+strlen(old_ld_preload) : 0) + 13 + len); + sprintf(optional_ld_preload, "LD_PRELOAD=%s/" EXEC_SO "%s%s", usr_in_appdir, + old_ld_preload ? ":" : "", old_ld_preload ? old_ld_preload : ""); } if (bundle_cxx == 1 && bundle_gcc == 0) {