aboutsummaryrefslogtreecommitdiffstats
path: root/exec
diff options
context:
space:
mode:
authorPo Lu2023-05-01 09:31:58 +0800
committerPo Lu2023-05-01 09:31:58 +0800
commit5550816f5962943abd81fbf68901dad575f18c06 (patch)
tree9fcb1305b7a3e80a349a9fba6f192d8b348cf7a5 /exec
parent9a7c645dd4ef38b72787e932d444a61ed4e04c63 (diff)
downloademacs-5550816f5962943abd81fbf68901dad575f18c06.tar.gz
emacs-5550816f5962943abd81fbf68901dad575f18c06.zip
Work around system restrictions regarding exec
* doc/emacs/android.texi (Android Environment): Document `android-use-exec-loader'. * exec/exec1.c (main): Set program group of child process. * src/android.c (android_rewrite_spawn_argv): New function. * src/android.h: Update prototypes. * src/androidfns.c (syms_of_androidfns): New variable `android_use_exec_loader'. * src/callproc.c (emacs_spawn): Rewrite the argument vector to use exec1 if necessary.
Diffstat (limited to 'exec')
-rw-r--r--exec/exec1.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/exec/exec1.c b/exec/exec1.c
index 835bf8e72b9..d77ca8adf54 100644
--- a/exec/exec1.c
+++ b/exec/exec1.c
@@ -20,6 +20,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
20#include <config.h> 20#include <config.h>
21#include <unistd.h> 21#include <unistd.h>
22#include <stdlib.h> 22#include <stdlib.h>
23#include <stdio.h>
23#include <sys/wait.h> 24#include <sys/wait.h>
24 25
25#include "exec.h" 26#include "exec.h"
@@ -41,10 +42,15 @@ main (int argc, char **argv)
41 extern char **environ; 42 extern char **environ;
42 int wstatus; 43 int wstatus;
43 44
45 pid1 = getpid ();
44 pid = fork (); 46 pid = fork ();
45 47
46 if (!pid) 48 if (!pid)
47 { 49 {
50 /* Set the process group used to the parent. */
51 if (setpgid (0, pid1))
52 perror ("setpgid");
53
48 tracing_execve (argv[2], argv + 2, environ); 54 tracing_execve (argv[2], argv + 2, environ);
49 55
50 /* An error occured. Exit with failure. */ 56 /* An error occured. Exit with failure. */