chiark / gitweb /
preload-hacks: Some patches to make it work.
[termux-packages] / packages / ninja / src-subprocess-posix.cc.patch
1 diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc
2 index 1de22c3..f988297 100644
3 --- a/src/subprocess-posix.cc
4 +++ b/src/subprocess-posix.cc
5 @@ -22,10 +22,10 @@
6  #include <stdio.h>
7  #include <string.h>
8  #include <sys/wait.h>
9 -#include <spawn.h>
10  
11  extern char** environ;
12  
13 +#include "posix_spawn.h"
14  #include "util.h"
15  
16  Subprocess::Subprocess(bool use_console) : fd_(-1), pid_(-1),
17 @@ -54,11 +54,11 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
18    SetCloseOnExec(fd_);
19  
20    posix_spawn_file_actions_t action;
21 -  if (posix_spawn_file_actions_init(&action) != 0)
22 +  /*if (posix_spawn_file_actions_init(&action) != 0)
23      Fatal("posix_spawn_file_actions_init: %s", strerror(errno));
24  
25    if (posix_spawn_file_actions_addclose(&action, output_pipe[0]) != 0)
26 -    Fatal("posix_spawn_file_actions_addclose: %s", strerror(errno));
27 +    Fatal("posix_spawn_file_actions_addclose: %s", strerror(errno));*/
28  
29    posix_spawnattr_t attr;
30    if (posix_spawnattr_init(&attr) != 0)
31 @@ -73,7 +73,7 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
32    // default action in the new process image, so no explicit
33    // POSIX_SPAWN_SETSIGDEF parameter is needed.
34  
35 -  if (!use_console_) {
36 +  /*if (!use_console_) {
37      // Put the child in its own process group, so ctrl-c won't reach it.
38      flags |= POSIX_SPAWN_SETPGROUP;
39      // No need to posix_spawnattr_setpgroup(&attr, 0), it's the default.
40 @@ -92,7 +92,7 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
41        Fatal("posix_spawn_file_actions_addclose: %s", strerror(errno));
42      // In the console case, output_pipe is still inherited by the child and
43      // closed when the subprocess finishes, which then notifies ninja.
44 -  }
45 +  }*/
46  #ifdef POSIX_SPAWN_USEVFORK
47    flags |= POSIX_SPAWN_USEVFORK;
48  #endif
49 @@ -100,15 +100,15 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
50    if (posix_spawnattr_setflags(&attr, flags) != 0)
51      Fatal("posix_spawnattr_setflags: %s", strerror(errno));
52  
53 -  const char* spawned_args[] = { "/bin/sh", "-c", command.c_str(), NULL };
54 -  if (posix_spawn(&pid_, "/bin/sh", &action, &attr,
55 +  const char* spawned_args[] = { "/system/bin/sh", "-c", command.c_str(), NULL };
56 +  if (posix_spawn(&pid_, "/system/bin/sh", &action, &attr,
57                    const_cast<char**>(spawned_args), environ) != 0)
58      Fatal("posix_spawn: %s", strerror(errno));
59  
60 -  if (posix_spawnattr_destroy(&attr) != 0)
61 +  /*if (posix_spawnattr_destroy(&attr) != 0)
62      Fatal("posix_spawnattr_destroy: %s", strerror(errno));
63    if (posix_spawn_file_actions_destroy(&action) != 0)
64 -    Fatal("posix_spawn_file_actions_destroy: %s", strerror(errno));
65 +    Fatal("posix_spawn_file_actions_destroy: %s", strerror(errno));*/
66  
67    close(output_pipe[1]);
68    return true;