summaryrefslogtreecommitdiff
path: root/exec
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-05-01 09:31:58 +0800
committerPo Lu <luangruo@yahoo.com>2023-05-01 09:31:58 +0800
commit5550816f5962943abd81fbf68901dad575f18c06 (patch)
tree9fcb1305b7a3e80a349a9fba6f192d8b348cf7a5 /exec
parent9a7c645dd4ef38b72787e932d444a61ed4e04c63 (diff)
downloademacs-5550816f5962943abd81fbf68901dad575f18c06.tar.gz
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/>. */
#include <config.h>
#include <unistd.h>
#include <stdlib.h>
+#include <stdio.h>
#include <sys/wait.h>
#include "exec.h"
@@ -41,10 +42,15 @@ main (int argc, char **argv)
extern char **environ;
int wstatus;
+ pid1 = getpid ();
pid = fork ();
if (!pid)
{
+ /* Set the process group used to the parent. */
+ if (setpgid (0, pid1))
+ perror ("setpgid");
+
tracing_execve (argv[2], argv + 2, environ);
/* An error occured. Exit with failure. */