X-Git-Url: https://jasonwoof.com/gitweb/?p=st.git;a=blobdiff_plain;f=st.c;h=45bc89d179e561ab7ecc317f08cdd8a33caad122;hp=a2703f41fbac001a45fe407462071d8074bb54a2;hb=ec3268961d1dc4072f6caa6f97db5436da2ff411;hpb=769d48180747c3255653360d161c77ec2a2e8d13 diff --git a/st.c b/st.c index a2703f4..45bc89d 100644 --- a/st.c +++ b/st.c @@ -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