zsh: disable fdsan

Issue https://github.com/termux/termux-packages/issues/6376
This commit is contained in:
Leonid Pliushch 2021-04-05 23:17:40 +03:00
parent fee131542c
commit 42515f9c26
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with 29 additions and 1 deletions

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Shell with lots of features"
TERMUX_PKG_LICENSE="BSD"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=5.8
TERMUX_PKG_REVISION=5
TERMUX_PKG_REVISION=6
TERMUX_PKG_SRCURL=https://fossies.org/linux/misc/zsh-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=dcc4b54cc5565670a65581760261c163d720991f0d06486da61f8d839b52de27
# Remove hard link to bin/zsh as Android does not support hard links:

View File

@ -0,0 +1,28 @@
diff -uNr zsh-5.8/Src/main.c zsh-5.8.mod/Src/main.c
--- zsh-5.8/Src/main.c 2019-12-14 00:41:30.000000000 +0200
+++ zsh-5.8.mod/Src/main.c 2021-04-05 23:17:04.559840264 +0300
@@ -30,6 +30,9 @@
#include "zsh.mdh"
#include "main.pro"
+#include <android/fdsan.h>
+#include <dlfcn.h>
+
/*
* Support for Cygwin binary/text mode filesystems.
* Peter A. Castro <doctor@fruitbat.org>
@@ -90,5 +93,14 @@
int
main(int argc, char **argv)
{
+ // For Android 11+.
+ void *lib_handle = dlopen("libc.so", RTLD_LAZY);
+ if (lib_handle) {
+ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level");
+ if (set_fdsan_error_level) {
+ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED);
+ }
+ dlclose(lib_handle);
+ }
return (zsh_main(argc, argv));
}