Update patch

This commit is contained in:
darealshinji 2017-12-20 22:55:39 +01:00
parent 15ef850406
commit 3ce0800e58
3 changed files with 50 additions and 43 deletions

View file

@ -41,14 +41,14 @@
ret = fscanf(f, "%s", sym); (void)ret; \
pclose(f);
#define CXXDIR "optional/libstdc++"
#define GCCDIR "optional/libgcc"
#define EXEC_SO "optional/exec.so"
#define CXXDIR "./optional/libstdc++"
#define GCCDIR "./optional/libgcc"
#define EXEC_SO "./optional/exec.so"
char *optional = NULL;
char *optional_ld_preload = NULL;
void checkrt(char *usr_in_appdir)
void checkrt()
{
int ret;
FILE *f;
@ -58,8 +58,8 @@ void checkrt(char *usr_in_appdir)
char stdcxx_bundle_sym[LINE_SIZE], gcc_bundle_sym[LINE_SIZE];
int stdcxx_sys_ver=1, stdcxx_bundle_ver=0, gcc_sys_ver=1, gcc_bundle_ver=0;
char *stdcxx_bundle_lib = "./" CXXDIR "/libstdc++.so.6";
char *gcc_bundle_lib = "./" GCCDIR "/libgcc_s.so.1";
char *stdcxx_bundle_lib = CXXDIR "/libstdc++.so.6";
char *gcc_bundle_lib = GCCDIR "/libgcc_s.so.1";
const char *format = "tr '\\0' '\\n' < '%s' | grep -e '%s' | tail -n1";
if (access(stdcxx_bundle_lib, F_OK) == 0) {
@ -94,7 +94,6 @@ void checkrt(char *usr_in_appdir)
int bundle_cxx = 0;
int bundle_gcc = 0;
size_t len = strlen(usr_in_appdir);
if (stdcxx_bundle_ver > stdcxx_sys_ver)
bundle_cxx = 1;
@ -103,23 +102,21 @@ void checkrt(char *usr_in_appdir)
bundle_gcc = 1;
if (bundle_cxx == 1 || bundle_gcc == 1) {
len = strlen(EXEC_SO) + 12 + len;
optional_ld_preload = malloc(len);
sprintf(optional_ld_preload, "LD_PRELOAD=%s/" EXEC_SO, usr_in_appdir);
optional_ld_preload[len] = '\0';
optional_ld_preload = malloc(strlen(EXEC_SO) + 12);
sprintf(optional_ld_preload, "LD_PRELOAD=" EXEC_SO);
}
if (bundle_cxx == 1 && bundle_gcc == 0) {
optional = malloc(strlen(CXXDIR) + 2 + len);
sprintf(optional, "%s/" CXXDIR ":", usr_in_appdir);
optional = malloc(strlen(CXXDIR) + 2);
sprintf(optional, CXXDIR ":");
} else if (bundle_cxx == 0 && bundle_gcc == 1) {
optional = malloc(strlen(GCCDIR) + 2 + len);
sprintf(optional, "%s/" GCCDIR ":", usr_in_appdir);
optional = malloc(strlen(GCCDIR) + 2);
sprintf(optional, GCCDIR ":");
} else if (bundle_cxx == 1 && bundle_gcc == 1) {
optional = malloc(strlen(GCCDIR) + strlen(CXXDIR) + 4 + len*2);
sprintf(optional, "%s/" GCCDIR ":%s/" CXXDIR ":", usr_in_appdir, usr_in_appdir);
optional = malloc(strlen(GCCDIR) + strlen(CXXDIR) + 3);
sprintf(optional, GCCDIR ":" CXXDIR ":");
} else {
optional = malloc(2);
optional = malloc(1);
sprintf(optional, "%s", "");
}
}