diff options
author | Jan Niklas Hasse <jhasse@bixense.com> | 2020-11-02 16:02:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 16:02:59 (GMT) |
commit | e87c49751ee7873cc402cf44ca28b23b827d2391 (patch) | |
tree | 8f2164435e0d8cb461b4a8afd0996063a8d40528 /src | |
parent | 0b5be1489acd5ab0f9d1e6d1734dc10ebbf77e0a (diff) | |
parent | 7ea6c537d2968effb024634a6367a1a1b4cafeb4 (diff) | |
download | Ninja-e87c49751ee7873cc402cf44ca28b23b827d2391.zip Ninja-e87c49751ee7873cc402cf44ca28b23b827d2391.tar.gz Ninja-e87c49751ee7873cc402cf44ca28b23b827d2391.tar.bz2 |
Merge pull request #1868 from kadler/fix-aix-signal-checking
Handle process signalling correctly on AIX
Diffstat (limited to 'src')
-rw-r--r-- | src/subprocess-posix.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc index 0c5f556..8e78540 100644 --- a/src/subprocess-posix.cc +++ b/src/subprocess-posix.cc @@ -154,6 +154,16 @@ ExitStatus Subprocess::Finish() { Fatal("waitpid(%d): %s", pid_, strerror(errno)); pid_ = -1; +#ifdef _AIX + if (WIFEXITED(status) && WEXITSTATUS(status) & 0x80) { + // Map the shell's exit code used for signal failure (128 + signal) to the + // status code expected by AIX WIFSIGNALED and WTERMSIG macros which, unlike + // other systems, uses a different bit layout. + int signal = WEXITSTATUS(status) & 0x7f; + status = (signal << 16) | signal; + } +#endif + if (WIFEXITED(status)) { int exit = WEXITSTATUS(status); if (exit == 0) |