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

@ -1,34 +1,44 @@
https://github.com/AppImage/AppImageKit/blob/ddcb5b98073ec251cbddda7a4eaa17545f06bbff/AppRun.c
--- a/AppRun.c
+++ b/AppRun.c
@@ -164,6 +164,10 @@
char *old_env;
size_t length;
const char *format;
+ checkrt(usr_in_appdir);
@@ -38,7 +38,7 @@
exit( 1 ); \
} while (0);
-#define NEW_LD_LIBRARY_PATH "LD_LIBRARY_PATH=./lib/:./lib/i386-linux-gnu/:./lib/x86_64-linux-gnu/:./lib32/:./lib64/:../lib/:../lib/i386-linux-gnu/:../lib/x86_64-linux-gnu/:../lib32/:../lib64/:%s"
+#define NEW_LD_LIBRARY_PATH "LD_LIBRARY_PATH=%s./lib/:./lib/i386-linux-gnu/:./lib/x86_64-linux-gnu/:./lib32/:./lib64/:../lib/:../lib/i386-linux-gnu/:../lib/x86_64-linux-gnu/:../lib32/:../lib64/:%s"
#define NEW_PATH "PATH=./bin/:./sbin/:./games/:../bin/:../sbin/:%s"
#define NEW_PYTHONPATH "PYTHONPATH=./share/pyshared/:%s"
#define NEW_XDG_DATA_DIRS "XDG_DATA_DIRS=./share/:%s"
@@ -138,8 +138,8 @@
char *env, *new_env[7];
env = getenv("LD_LIBRARY_PATH") ?: "";
- new_env[0] = malloc( strlen(NEW_LD_LIBRARY_PATH) + strlen(env) );
- sprintf( new_env[0], NEW_LD_LIBRARY_PATH, env );
+ new_env[0] = malloc( strlen(NEW_LD_LIBRARY_PATH) + strlen(optional) + strlen(env) );
+ sprintf( new_env[0], NEW_LD_LIBRARY_PATH, optional, env );
// printf( " using %s\n", new_env[0] );
putenv( new_env[0] );
@@ -179,6 +179,11 @@
// printf( " using %s\n", new_env[6] );
putenv( new_env[6] );
+ checkrt();
+
+ if (optional_ld_preload)
+ putenv(optional_ld_preload);
+
/* Run */
ret = execvp(executable, argv);
/* https://docs.python.org/2/using/cmdline.html#envvar-PYTHONHOME */
SET_NEW_ENV(new_pythonhome, appdir_s, "PYTHONHOME=%s/usr/", appdir);
@@ -172,7 +176,7 @@
SET_NEW_ENV(new_path, appdir_s*5 + strlen(old_env), "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") ?: "";
- SET_NEW_ENV(new_ld_library_path, appdir_s*10 + strlen(old_env), "LD_LIBRARY_PATH=%s/usr/lib/:%s/usr/lib/i386-linux-gnu/:%s/usr/lib/x86_64-linux-gnu/:%s/usr/lib32/:%s/usr/lib64/:%s/lib/:%s/lib/i386-linux-gnu/:%s/lib/x86_64-linux-gnu/:%s/lib32/:%s/lib64/:%s", appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, old_env);
+ SET_NEW_ENV(new_ld_library_path, appdir_s*10 + strlen(old_env), "LD_LIBRARY_PATH=%s%s/usr/lib/:%s/usr/lib/i386-linux-gnu/:%s/usr/lib/x86_64-linux-gnu/:%s/usr/lib32/:%s/usr/lib64/:%s/lib/:%s/lib/i386-linux-gnu/:%s/lib/x86_64-linux-gnu/:%s/lib32/:%s/lib64/:%s", optional, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, old_env);
old_env = getenv("PYTHONPATH") ?: "";
SET_NEW_ENV(new_pythonpath, appdir_s + strlen(old_env), "PYTHONPATH=%s/usr/share/pyshared/:%s", appdir, old_env);
@@ -201,6 +205,9 @@
if (ret == -1)
die("Error executing '%s': %s\n", exe, strerror(error));
@@ -187,6 +192,9 @@
die( "Error executing '%s'; return code: %d\n", executable, ret );
}
+ free(optional);
+ if (optional_ld_preload)
+ free(optional_ld_preload);
free(line);
free(desktop_file);
free(usr_in_appdir);
free(new_env[6]);
free(new_env[5]);
free(new_env[4]);