diff options
Diffstat (limited to 'st.c')
| -rw-r--r-- | st.c | 11 |
1 files changed, 5 insertions, 6 deletions
| @@ -1176,16 +1176,15 @@ execsh(void) { | |||
| 1176 | 1176 | ||
| 1177 | void | 1177 | void |
| 1178 | sigchld(int a) { | 1178 | sigchld(int a) { |
| 1179 | int stat = 0; | 1179 | int stat, ret; |
| 1180 | 1180 | ||
| 1181 | if(waitpid(pid, &stat, 0) < 0) | 1181 | if(waitpid(pid, &stat, 0) < 0) |
| 1182 | die("Waiting for pid %hd failed: %s\n", pid, strerror(errno)); | 1182 | die("Waiting for pid %hd failed: %s\n", pid, strerror(errno)); |
| 1183 | 1183 | ||
| 1184 | if(WIFEXITED(stat)) { | 1184 | ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE; |
| 1185 | exit(WEXITSTATUS(stat)); | 1185 | if (ret != EXIT_SUCCESS) |
| 1186 | } else { | 1186 | die("child finished with error '%d'\n", stat); |
| 1187 | exit(EXIT_FAILURE); | 1187 | exit(EXIT_SUCCESS); |
| 1188 | } | ||
| 1189 | } | 1188 | } |
| 1190 | 1189 | ||
| 1191 | void | 1190 | void |
