summaryrefslogtreecommitdiff
path: root/shells/bash/files/patch-jobs.c
blob: 4e5db16b983a00cc40fc70667007ce33b5e9aeda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Fix pipefail option
#
# http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00215.html
#
--- jobs.c.orig	Fri Apr 23 21:28:25 2004
+++ jobs.c	Wed Aug 18 14:32:19 2004
@@ -1778,8 +1778,11 @@
   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;
     }