*** ../bash-4.3-patched/execute_cmd.c	2014-01-31 10:54:52.000000000 -0500
--- execute_cmd.c	2014-06-19 08:05:49.000000000 -0400
***************
*** 2410,2414 ****
        lstdin = wait_for (lastpid);
  #if defined (JOB_CONTROL)
!       exec_result = job_exit_status (lastpipe_jid);
  #endif
        unfreeze_jobs_list ();
--- 2425,2438 ----
        lstdin = wait_for (lastpid);
  #if defined (JOB_CONTROL)
!       /* If wait_for removes the job from the jobs table, use result of last
! 	 command as pipeline's exit status as usual.  The jobs list can get
! 	 frozen and unfrozen at inconvenient times if there are multiple pipelines
! 	 running simultaneously. */
!       if (INVALID_JOB (lastpipe_jid) == 0)
! 	exec_result = job_exit_status (lastpipe_jid);
!       else if (pipefail_opt)
! 	exec_result = exec_result | lstdin;	/* XXX */
!       /* otherwise we use exec_result */
!         
  #endif
        unfreeze_jobs_list ();
