---
st.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/st.c b/st.c
index a2703f4..45bc89d 100644
--- a/st.c
+++ b/st.c
_AT_@ -1176,16 +1176,15 @@ execsh(void) {
void
sigchld(int a) {
- int stat = 0;
+ int stat, ret;
if(waitpid(pid, &stat, 0) < 0)
die("Waiting for pid %hd failed: %s\n", pid, strerror(errno));
- if(WIFEXITED(stat)) {
- exit(WEXITSTATUS(stat));
- } else {
- exit(EXIT_FAILURE);
- }
+ ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE;
+ if (ret != EXIT_SUCCESS)
+ die("child finished with error '%d'\n", stat);
+ exit(EXIT_SUCCESS);
}
void
--
1.8.5.3
Received on Mon Aug 04 2014 - 22:10:46 CEST
This archive was generated by hypermail 2.3.0 : Mon Aug 04 2014 - 22:24:07 CEST