]> git.ipfire.org Git - thirdparty/make.git/commitdiff
Don't reset stack size when using posix_spawn()
authorPaul Smith <psmith@gnu.org>
Tue, 3 Sep 2019 03:03:27 +0000 (23:03 -0400)
committerPaul Smith <psmith@gnu.org>
Sat, 7 Sep 2019 22:27:26 +0000 (18:27 -0400)
There's no way to run setrlimit() from posix_spawn() so we can't reset
the stack limit in children; thus, don't change it in the parent.

* src/makeint.h (SET_STACK_SIZE): Don't set this when HAVE_POSIX_SPAWN.
* src/job.c (child_execute_job): Remove useless comment.

src/job.c
src/makeint.h

index f4f2113f405242601f451af28dc903f7f6aa15ad..34a6e66657e5516b336c444da8a3cbbdcb94da87 100644 (file)
--- a/src/job.c
+++ b/src/job.c
@@ -2308,10 +2308,6 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
   flags |= POSIX_SPAWN_USEVFORK;
 #endif
 
-#ifdef SET_STACK_SIZE
-  /* No support for resetting the stack limit with posix_spawn().  */
-#endif
-
   /* For any redirected FD, dup2() it to the standard FD.
      They are all marked close-on-exec already.  */
   if (fdin >= 0 && fdin != FD_STDIN)
index d13c3135a22eb27dc6f59a0b01e1ffad14734636..6c9492c491e4a9094917fa2f1fcdf29d037a7ee2 100644 (file)
@@ -447,7 +447,8 @@ extern int unixy_shell;
 #define NEXT_TOKEN(s)   while (ISSPACE (*(s))) ++(s)
 #define END_OF_TOKEN(s) while (! STOP_SET (*(s), MAP_SPACE|MAP_NUL)) ++(s)
 
-#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
+/* We can't run setrlimit when using posix_spawn.  */
+#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && !defined(USE_POSIX_SPAWN)
 # define SET_STACK_SIZE
 #endif
 #ifdef SET_STACK_SIZE