inetutils: disable fdsan for "whois"

https://github.com/termux/termux-packages/issues/5980
This commit is contained in:
Leonid Pliushch 2021-04-10 16:59:23 +03:00
parent 7c5960ebe2
commit bb62878def
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with 31 additions and 1 deletions

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Collection of common network programs"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.9.4
TERMUX_PKG_REVISION=10
TERMUX_PKG_REVISION=11
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/inetutils/inetutils-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=849d96f136effdef69548a940e3e0ec0624fc0c81265296987986a0dd36ded37
TERMUX_PKG_DEPENDS="readline"

View File

@ -0,0 +1,30 @@
diff -uNr inetutils-1.9.4/whois/whois.c inetutils-1.9.4.mod/whois/whois.c
--- inetutils-1.9.4/whois/whois.c 2015-03-31 18:40:50.000000000 +0300
+++ inetutils-1.9.4.mod/whois/whois.c 2021-04-10 16:58:42.989309373 +0300
@@ -49,6 +49,9 @@
#include <whois.h>
#include "xalloc.h"
+#include <android/fdsan.h>
+#include <dlfcn.h>
+
/* Global variables */
int sockfd, verb = 0;
struct obstack query_stk;
@@ -207,6 +210,16 @@
char *qstring;
char *p;
+ // 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);
+ }
+
set_program_name (argv[0]);
#ifdef ENABLE_NLS