summaryrefslogtreecommitdiff
path: root/jobs.c
diff options
context:
space:
mode:
Diffstat (limited to 'jobs.c')
-rw-r--r--jobs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/jobs.c b/jobs.c
index 8418267b..b10a8a22 100644
--- a/jobs.c
+++ b/jobs.c
@@ -1778,8 +1778,13 @@ raw_job_exit_status (job)
if (pipefail_opt)
{
fail = 0;
- for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next)
- if (p->status != EXECUTION_SUCCESS) fail = p->status;
+ p = jobs[job]->pipe;
+ do
+ {
+ if (p->status != EXECUTION_SUCCESS) fail = p->status;
+ p = p->next;
+ }
+ while (p != jobs[job]->pipe);
return fail;
}