summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-02 02:30:34 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-02 02:32:35 +0100
commit9cfcea48e46deb9755c049c2f435843ac702b91c (patch)
tree237957e8783752234f9974f53177ced730310ab0
parent43343b9b518b912823c4d0be0db3594075e77e12 (diff)
downloadcrawl-ref-9cfcea48e46deb9755c049c2f435843ac702b91c.tar.gz
crawl-ref-9cfcea48e46deb9755c049c2f435843ac702b91c.zip
Fix fake_pty not passing return codes correctly.
-rw-r--r--crawl-ref/source/util/fake_pty.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crawl-ref/source/util/fake_pty.c b/crawl-ref/source/util/fake_pty.c
index 20d2c37858..5db9d78cd7 100644
--- a/crawl-ref/source/util/fake_pty.c
+++ b/crawl-ref/source/util/fake_pty.c
@@ -78,7 +78,13 @@ int main(int argc, char * const *argv)
close(slave);
slurp_output();
if (waitpid(crawl, &ret, 0) != crawl)
- ret = 1; // can't happen
- return ret;
+ return 1; // can't happen
+ if (WIFEXITED(ret))
+ return WEXITSTATUS(ret);
+ if (WIFSIGNALED(ret))
+ return 128 + WTERMSIG(ret);
+ // Neither exited nor signaled? Did the process eat mushrooms meant
+ // fo the mother-in-law or what?
+ return 1;
}
}