0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 14:13:36 +00:00
termux-packages/packages/fakeroot/dont-wrap-while-environ-is-null.patch
Tee KOBAYASHI 184f895a80 fakeroot: Bump to 1.30.1
and add workaround for

```
libfakeroot: FAKEROOTKEY not defined in environment
```

on some Android version.
2022-11-12 14:50:20 +00:00

28 lines
658 B
Diff

Workaround for https://github.com/termux/termux-packages/issues/3148.
--- a/libfakeroot.c
+++ b/libfakeroot.c
@@ -699,6 +699,22 @@ int WRAP_FSTAT FSTAT_ARG(int ver,
int fd,
struct stat *st){
+#ifdef __ANDROID__
+ static int initialized = 0;
+ if (!initialized) {
+ if (environ == NULL) {
+ void *libc_handle = dlopen("libc.so", RTLD_NOW);
+ if (libc_handle == NULL)
+ __builtin_abort();
+ int (*libc_impl)(int, struct stat *) = dlsym(libc_handle, "fstat");
+ if (libc_impl == NULL)
+ __builtin_abort();
+ return libc_impl(fd, st);
+ } else {
+ initialized = 1;
+ }
+ }
+#endif
int r;