mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Make system() and popen() thread safe
This commit is contained in:
parent
997ce29ddc
commit
f52f65b2e3
19 changed files with 135 additions and 31 deletions
|
@ -20,9 +20,12 @@
|
|||
#include "libc/calls/struct/sigaction.h"
|
||||
#include "libc/calls/struct/sigset.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/stdio/posix_spawn.h"
|
||||
#include "libc/stdio/posix_spawn.internal.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/thread/tls.h"
|
||||
|
||||
static int RunFileActions(struct _posix_faction *a) {
|
||||
int t;
|
||||
|
@ -68,7 +71,7 @@ int posix_spawn(int *pid, const char *path,
|
|||
int s, child;
|
||||
sigset_t allsigs;
|
||||
struct sigaction dfl;
|
||||
if (!(child = vfork())) {
|
||||
if (!(child = _weaken(pthread_create) ? fork() : vfork())) {
|
||||
if (attrp && *attrp) {
|
||||
if ((*attrp)->flags & POSIX_SPAWN_SETPGROUP) {
|
||||
if (setpgid(0, (*attrp)->pgroup)) _Exit(127);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue