Fix crashes runninging android-emacs with bad LD_LIBRARY_PATH
* doc/emacs/input.texi (Touchscreens, On-Screen Keyboards): Fix section titles. * src/android-emacs.c (main): If EMACS_LD_LIBRARY_PATH is set, make it LD_LIBRARY_PATH. * src/android.c (JNICALL): Set LD_LIBRARY_PATH as well as EMACS_LD_LIBRARY_PATH.
This commit is contained in:
parent
82a67d227e
commit
3b34b85cc8
3 changed files with 25 additions and 10 deletions
|
@ -20,7 +20,7 @@ which is detailed here.
|
|||
@end menu
|
||||
|
||||
@node Touchscreens
|
||||
@section Using Emacs on touchscreens
|
||||
@section Using Emacs on Touchscreens
|
||||
@cindex touchscreen input
|
||||
|
||||
Touchscreen input works by pressing and moving tools (which include
|
||||
|
@ -97,7 +97,7 @@ this can be changed by customizing the variable
|
|||
@code{touch-screen-delay}.
|
||||
|
||||
@node On-Screen Keyboards
|
||||
@section Using Emacs with virtual keyboards
|
||||
@section Using Emacs with Virtual Keyboards
|
||||
@cindex virtual keyboards
|
||||
@cindex on-screen keyboards
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ main (int argc, char **argv)
|
|||
{
|
||||
char **args;
|
||||
int i;
|
||||
char *bootclasspath, *emacs_class_path;
|
||||
char *bootclasspath, *emacs_class_path, *ld_library_path;
|
||||
|
||||
/* Allocate enough to hold the arguments to app_process. */
|
||||
args = alloca ((10 + argc) * sizeof *args);
|
||||
|
@ -46,11 +46,11 @@ main (int argc, char **argv)
|
|||
memset (args, 0, (10 + argc) * sizeof *args);
|
||||
|
||||
/* First, figure out what program to start. */
|
||||
#if defined __x86_64__ || defined __aarch64__
|
||||
#if defined __x86_64__ || defined __aarch64__ || defined __mips64
|
||||
args[0] = (char *) "/system/bin/app_process64";
|
||||
#else
|
||||
#else /* i386 || regular mips || arm */
|
||||
args[0] = (char *) "/system/bin/app_process";
|
||||
#endif
|
||||
#endif /* __x86_64__ || __aarch64__ || __mips64 */
|
||||
|
||||
/* Machines with ART require the boot classpath to be manually
|
||||
specified. Machines with Dalvik however refuse to do so, as they
|
||||
|
@ -72,13 +72,13 @@ main (int argc, char **argv)
|
|||
bootclasspath = NULL;
|
||||
goto skip_setup;
|
||||
}
|
||||
#else
|
||||
#else /* !HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL */
|
||||
if (__ANDROID_API__ < 21)
|
||||
{
|
||||
bootclasspath = NULL;
|
||||
goto skip_setup;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL */
|
||||
|
||||
/* Next, obtain the boot class path. */
|
||||
bootclasspath = getenv ("BOOTCLASSPATH");
|
||||
|
@ -106,6 +106,15 @@ main (int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Restore LD_LIBRARY_PATH to its original value, the app library
|
||||
directory, to guarantee that it is possible for Java to find the
|
||||
Emacs C code later. */
|
||||
|
||||
ld_library_path = getenv ("EMACS_LD_LIBRARY_PATH");
|
||||
|
||||
if (ld_library_path)
|
||||
setenv ("LD_LIBRARY_PATH", ld_library_path, 1);
|
||||
|
||||
if (bootclasspath)
|
||||
{
|
||||
if (asprintf (&bootclasspath, "-Djava.class.path=%s:%s",
|
||||
|
@ -146,7 +155,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
#endif /* HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL */
|
||||
args[3] = (char *) "org.gnu.emacs.EmacsNoninteractive";
|
||||
|
||||
/* Arguments from here on are passed to main in
|
||||
|
@ -158,7 +167,7 @@ main (int argc, char **argv)
|
|||
args[4 + i] = argv[i];
|
||||
#if HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_DECL_ANDROID_GET_DEVICE_API_LEVEL */
|
||||
|
||||
/* Finally, try to start the app_process. */
|
||||
execvp (args[0], args);
|
||||
|
|
|
@ -1424,6 +1424,12 @@ NATIVE_NAME (setEmacsParams) (JNIEnv *env, jobject object,
|
|||
/* Set LD_LIBRARY_PATH to an appropriate value. */
|
||||
setenv ("LD_LIBRARY_PATH", android_lib_dir, 1);
|
||||
|
||||
/* EMACS_LD_LIBRARY_PATH records the location of the app library
|
||||
directory. android-emacs refers to this, since users have valid
|
||||
reasons for changing LD_LIBRARY_PATH to a value that precludes
|
||||
the possibility of Java locating libemacs later. */
|
||||
setenv ("EMACS_LD_LIBRARY_PATH", android_lib_dir, 1);
|
||||
|
||||
/* Make a reference to the Emacs service. */
|
||||
|
||||
if (emacs_service_object)
|
||||
|
|
Loading…
Add table
Reference in a new issue