renameutils: disable fdsan

This commit is contained in:
Chongyun Lee 2022-06-17 18:56:48 +08:00 committed by YAKSH BARIYA
parent 2056aad712
commit a082024725
2 changed files with 30 additions and 1 deletions

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="A set of programs designed to make renaming of files fas
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.12.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://savannah.nongnu.org/download/renameutils/renameutils-$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=cbd2f002027ccf5a923135c3f529c6d17fabbca7d85506a394ca37694a9eb4a3
TERMUX_PKG_DEPENDS="libandroid-wordexp, readline"

View File

@ -0,0 +1,29 @@
diff -uNr renameutils-0.12.0/src/qcmd.c renameutils-0.12.0.mod/src/qcmd.c
--- renameutils-0.12.0/src/qcmd.c 2022-06-17 18:18:07.573138900 +0800
+++ renameutils-0.12.0.mod/src/qcmd.c 2022-06-17 18:21:25.330399000 +0800
@@ -40,6 +40,9 @@
#include "common/llist.h"
#include "qcmd.h"
+#include <android/fdsan.h>
+#include <dlfcn.h>
+
char *program;
bool simulate = false;
bool verbose = false;
@@ -157,6 +160,16 @@
char *format_options = NULL;
bool interactive = false;
+ // 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]);
program = base_name(program_name);