fix(fakeroot): removed hangup when executing commands (#13048)

This commit is contained in:
Ivan Max 2022-11-12 19:42:02 +00:00 committed by GitHub
parent ddb1ce8378
commit 9cb2b33e77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 0 deletions

View File

@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Tool for simulating superuser privileges (with tcp ipc)"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.30.1
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://deb.debian.org/debian/pool/main/f/fakeroot/fakeroot_${TERMUX_PKG_VERSION}.orig.tar.gz
TERMUX_PKG_SHA256=32ebb1f421aca0db7141c32a8c104eb95d2b45c393058b9435fbf903dd2b6a75
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-ipc=tcp"

View File

@ -0,0 +1,52 @@
--- fakeroot-1.30.1/communicate.c 2022-01-17 23:42:20.000000000 +0300
+++ fakeroot-1.30.1/communicate.c.patch 2022-11-11 22:36:56.954338881 +0300
@@ -494,9 +494,9 @@
}
}
-void lock_comm_sd(void)
+int lock_comm_sd(void)
{
- pthread_mutex_lock(&comm_sd_mutex);
+ return pthread_mutex_trylock(&comm_sd_mutex);
}
void unlock_comm_sd(void)
@@ -654,12 +654,12 @@
void send_fakem(const struct fake_msg *buf)
{
- lock_comm_sd();
+ if (!lock_comm_sd()) {
+ open_comm_sd();
+ send_fakem_nr(buf);
- open_comm_sd();
- send_fakem_nr(buf);
-
- unlock_comm_sd();
+ unlock_comm_sd();
+ }
}
static void get_fakem_nr(struct fake_msg *buf)
@@ -694,13 +694,13 @@
void send_get_fakem(struct fake_msg *buf)
{
- lock_comm_sd();
+ if (!lock_comm_sd()) {
+ open_comm_sd();
+ send_fakem_nr(buf);
+ get_fakem_nr(buf);
- open_comm_sd();
- send_fakem_nr(buf);
- get_fakem_nr(buf);
-
- unlock_comm_sd();
+ unlock_comm_sd();
+ }
}
#endif /* FAKEROOT_FAKENET */