Don't reset stack size when using posix_spawn()

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.
This commit is contained in:
Paul Smith 2019-09-02 23:03:27 -04:00
parent 757a9d06e3
commit 4f3a41c60a
2 changed files with 2 additions and 5 deletions

View File

@ -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)

View 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