| 1958 | | } else if (!job_assumes(j, wait4(j->p, &status, 0, &ru) != -1)) { |
| 1959 | | job_log(j, LOG_NOTICE, "Working around 5020256. Assuming the job crashed."); |
| 1960 | | |
| 1961 | | status = W_EXITCODE(0, SIGSEGV); |
| 1962 | | |
| 1963 | | memset(&ru, 0, sizeof(ru)); |
| | 1958 | } else { |
| | 1959 | /* |
| | 1960 | * The job is dead. While the PID/PGID is still known to be |
| | 1961 | * valid, try to kill abandoned descendant processes. |
| | 1962 | * |
| | 1963 | * We'd use job_assumes(), but POSIX defines consistency over |
| | 1964 | * correctness, and consequently kill/killpg now returns EPERM |
| | 1965 | * instead of ESRCH. As luck would have it, ESRCH is the only |
| | 1966 | * error we can ignore. |
| | 1967 | */ |
| | 1968 | killpg(j->p, SIGKILL); |
| | 1969 | |
| | 1970 | if (!job_assumes(j, wait4(j->p, &status, 0, &ru) != -1)) { |
| | 1971 | job_log(j, LOG_NOTICE, "Working around 5020256. Assuming the job crashed."); |
| | 1972 | |
| | 1973 | status = W_EXITCODE(0, SIGSEGV); |
| | 1974 | memset(&ru, 0, sizeof(ru)); |
| | 1975 | } |