Merge pull request #5 from pamarcos/append_ld_preload

Append old LD_PRELOAD when modifying it
This commit is contained in:
darealshinji 2018-01-06 11:43:00 +01:00 committed by GitHub
commit 2f04ad81c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,8 +106,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) {