forked from pelya/debian-noroot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proot-android.patch
43 lines (41 loc) · 1.25 KB
/
proot-android.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
diff --git a/src/loader/assembly-arm.h b/src/loader/assembly-arm.h
index 365b822..5ae3d74 100644
--- a/src/loader/assembly-arm.h
+++ b/src/loader/assembly-arm.h
@@ -29,13 +29,13 @@
*/
#define BRANCH(stack_pointer, destination) do { \
asm volatile ( \
- "// Restore initial stack pointer. \n\t" \
+ "/* Restore initial stack pointer. */ \n\t" \
"mov sp, %0 \n\t" \
" \n\t" \
- "// Clear rtld_fini. \n\t" \
+ "/* Clear rtld_fini. */ \n\t" \
"mov r0, #0 \n\t" \
" \n\t" \
- "// Start the program. \n\t" \
+ "/* Start the program. */ \n\t" \
"mov pc, %1 \n" \
: /* no output */ \
: "r" (stack_pointer), "r" (destination) \
diff --git a/src/path/temp.c b/src/path/temp.c
index bbcfb5f..b0d1b53 100644
--- a/src/path/temp.c
+++ b/src/path/temp.c
@@ -10,6 +10,17 @@
#include "cli/note.h"
+static const char *proot_tmpdir = P_tmpdir;
+
+/* __attribute__((constructor)) is GCC-specific extension */
+__attribute__((constructor)) static void init_tmpdir()
+{
+ if (getenv("PROOT_TMPDIR") != NULL)
+ proot_tmpdir = getenv("PROOT_TMPDIR");
+}
+
+#define P_tmpdir proot_tmpdir
+
/**
* Remove recursively the content of the current working directory.
* This latter has to lie in P_tmpdir (ie. "/tmp" on most systems).