From 5ea055bf0b4083c19e58317a2ce4d5f3bdb3d9a6 Mon Sep 17 00:00:00 2001 From: Leonid Plyushch Date: Fri, 10 Jan 2020 12:52:01 +0200 Subject: [PATCH] mtools: fix "bad system call" errors --- packages/mtools/build.sh | 4 +-- packages/mtools/no-privs.patch | 54 ++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 packages/mtools/no-privs.patch diff --git a/packages/mtools/build.sh b/packages/mtools/build.sh index f03eca9a0..8757f9719 100644 --- a/packages/mtools/build.sh +++ b/packages/mtools/build.sh @@ -2,9 +2,9 @@ TERMUX_PKG_HOMEPAGE=https://www.gnu.org/software/mtools/ TERMUX_PKG_DESCRIPTION="Tool for manipulating FAT images." TERMUX_PKG_LICENSE="GPL-2.0" TERMUX_PKG_VERSION=4.0.23 -TERMUX_PKG_REVISION=2 -TERMUX_PKG_SHA256=f188db26751aeb5692a79b2380b440ecc05fd1848a52f869d7ca1193f2ef8ee3 +TERMUX_PKG_REVISION=3 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/mtools/mtools-${TERMUX_PKG_VERSION}.tar.bz2 +TERMUX_PKG_SHA256=f188db26751aeb5692a79b2380b440ecc05fd1848a52f869d7ca1193f2ef8ee3 TERMUX_PKG_DEPENDS="libandroid-support, libiconv" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" diff --git a/packages/mtools/no-privs.patch b/packages/mtools/no-privs.patch new file mode 100644 index 000000000..9a8592edb --- /dev/null +++ b/packages/mtools/no-privs.patch @@ -0,0 +1,54 @@ +diff -uNr mtools-4.0.23/privileges.c mtools-4.0.23.mod/privileges.c +--- mtools-4.0.23/privileges.c 2018-12-09 12:57:33.000000000 +0200 ++++ mtools-4.0.23.mod/privileges.c 2020-01-10 12:49:08.689245870 +0200 +@@ -93,6 +93,9 @@ + + static __inline__ void Setuid(uid_t uid) + { ++#ifdef __ANDROID__ ++ return; ++#endif + #if defined HAVE_SETEUID || defined HAVE_SETRESUID + if(euid == 0) { + #ifdef HAVE_SETEUID +@@ -110,6 +113,9 @@ + + void reclaim_privs(void) + { ++#ifdef __ANDROID__ ++ return; ++#endif + if(noPrivileges) + return; + setgid(egid); +@@ -119,6 +125,9 @@ + + void drop_privs(void) + { ++#ifdef __ANDROID__ ++ return; ++#endif + Setuid(ruid); + setgid(rgid); + print_privs("after drop_privs, real should be 0, effective should not "); +@@ -126,7 +135,9 @@ + + void destroy_privs(void) + { +- ++#ifdef __ANDROID__ ++ return; ++#endif + #if defined HAVE_SETEUID || defined HAVE_SETRESUID + if(euid == 0) { + #ifdef HAVE_SETEUID +@@ -159,6 +170,9 @@ + + void init_privs(void) + { ++#ifdef __ANDROID__ ++ return; ++#endif + euid = geteuid(); + ruid = getuid(); + egid = getegid();