mirror of
https://github.com/yuzu-emu/AppImageKit-checkrt.git
synced 2025-02-03 00:21:04 +00:00
Fixing memory access violation issues
This commit is contained in:
parent
71106b1794
commit
2b645a7f55
|
@ -1,23 +1,14 @@
|
||||||
--- a/AppRun.c
|
--- a/AppRun.c
|
||||||
+++ b/AppRun.c
|
+++ b/AppRun.c
|
||||||
@@ -44,6 +44,8 @@
|
@@ -156,6 +156,7 @@
|
||||||
|
|
||||||
#define LINE_SIZE 255
|
|
||||||
|
|
||||||
+char *checkrt(char *usr_in_appdir);
|
|
||||||
+
|
|
||||||
int filter(const struct dirent *dir) {
|
|
||||||
char *p = (char*) &dir->d_name;
|
|
||||||
p = strrchr(p, '.');
|
|
||||||
@@ -156,6 +158,7 @@
|
|
||||||
char *old_env;
|
char *old_env;
|
||||||
const int length = 2047;
|
const int length = 2047;
|
||||||
char new_env[8][length+1];
|
char new_env[8][length+1];
|
||||||
+ char *optional = checkrt(usr_in_appdir);
|
+ checkrt(usr_in_appdir);
|
||||||
|
|
||||||
/* https://docs.python.org/2/using/cmdline.html#envvar-PYTHONHOME */
|
/* https://docs.python.org/2/using/cmdline.html#envvar-PYTHONHOME */
|
||||||
snprintf(new_env[0], length, "PYTHONHOME=%s/usr/", appdir);
|
snprintf(new_env[0], length, "PYTHONHOME=%s/usr/", appdir);
|
||||||
@@ -164,7 +167,7 @@
|
@@ -164,7 +165,7 @@
|
||||||
snprintf(new_env[1], length, "PATH=%s/usr/bin/:%s/usr/sbin/:%s/usr/games/:%s/bin/:%s/sbin/:%s", appdir, appdir, appdir, appdir, appdir, old_env);
|
snprintf(new_env[1], length, "PATH=%s/usr/bin/:%s/usr/sbin/:%s/usr/games/:%s/bin/:%s/sbin/:%s", appdir, appdir, appdir, appdir, appdir, old_env);
|
||||||
|
|
||||||
old_env = getenv("LD_LIBRARY_PATH") ?: "";
|
old_env = getenv("LD_LIBRARY_PATH") ?: "";
|
||||||
|
|
1
Makefile
1
Makefile
|
@ -1,4 +1,5 @@
|
||||||
CFLAGS ?= -O2 -Wall -Wextra
|
CFLAGS ?= -O2 -Wall -Wextra
|
||||||
|
CFLAGS += -include checkrt.h
|
||||||
LDFLAGS += -s
|
LDFLAGS += -s
|
||||||
BIN = AppRun_patched
|
BIN = AppRun_patched
|
||||||
|
|
||||||
|
|
22
checkrt.c
22
checkrt.c
|
@ -44,10 +44,10 @@
|
||||||
#define CXXDIR "optional/libstdc++"
|
#define CXXDIR "optional/libstdc++"
|
||||||
#define GCCDIR "optional/libgcc"
|
#define GCCDIR "optional/libgcc"
|
||||||
|
|
||||||
|
char optional[1024];
|
||||||
|
|
||||||
char *checkrt(char *usr_in_appdir)
|
void checkrt(char *usr_in_appdir)
|
||||||
{
|
{
|
||||||
char path[1024];
|
|
||||||
int ret;
|
int ret;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
char command[LINE_SIZE];
|
char command[LINE_SIZE];
|
||||||
|
@ -99,22 +99,14 @@ char *checkrt(char *usr_in_appdir)
|
||||||
if (gcc_bundle_ver > gcc_sys_ver)
|
if (gcc_bundle_ver > gcc_sys_ver)
|
||||||
bundle_gcc = 1;
|
bundle_gcc = 1;
|
||||||
|
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
if (bundle_cxx == 1 && bundle_gcc == 0) {
|
if (bundle_cxx == 1 && bundle_gcc == 0) {
|
||||||
sprintf(path, "%s/" CXXDIR ":", usr_in_appdir);
|
sprintf(optional, "%s/" CXXDIR ":", usr_in_appdir);
|
||||||
strcpy(tmp, path);
|
|
||||||
return tmp;
|
|
||||||
} else if (bundle_cxx == 0 && bundle_gcc == 1) {
|
} else if (bundle_cxx == 0 && bundle_gcc == 1) {
|
||||||
sprintf(path, "%s/" GCCDIR ":", usr_in_appdir);
|
sprintf(optional, "%s/" GCCDIR ":", usr_in_appdir);
|
||||||
strcpy(tmp, path);
|
|
||||||
return tmp;
|
|
||||||
} else if (bundle_cxx == 1 && bundle_gcc == 1) {
|
} else if (bundle_cxx == 1 && bundle_gcc == 1) {
|
||||||
sprintf(path, "%s/" GCCDIR ":%s/" CXXDIR ":", usr_in_appdir, usr_in_appdir);
|
sprintf(optional, "%s/" GCCDIR ":%s/" CXXDIR ":", usr_in_appdir, usr_in_appdir);
|
||||||
strcpy(tmp, path);
|
} else {
|
||||||
return tmp;
|
sprintf(optional, "%s", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue