View | Details | Raw Unified | Return to bug 224270 | Differences between
and this patch

Collapse All | Expand All

(-)b/bin/sh/Makefile (-1 / +1 lines)
Lines 26-32 LIBADD= edit Link Here
26
26
27
CFLAGS+=-DSHELL -I. -I${.CURDIR}
27
CFLAGS+=-DSHELL -I. -I${.CURDIR}
28
# for debug:
28
# for debug:
29
# DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
29
DEBUG_FLAGS+= -g -DDEBUG=2 -fno-inline
30
WARNS?=	2
30
WARNS?=	2
31
WFORMAT=0
31
WFORMAT=0
32
32
(-)b/bin/sh/jobs.c (+9 lines)
Lines 1076-1081 waitforjob(struct job *jp, int *signaled) Link Here
1076
		setcurjob(jp);
1076
		setcurjob(jp);
1077
#endif
1077
#endif
1078
	status = jp->ps[jp->nprocs - 1].status;
1078
	status = jp->ps[jp->nprocs - 1].status;
1079
	for (int i = 0; i < jp->nprocs; i++) {
1080
		TRACE(("waitforjob: ps[%d].status=%d\n", i, jp->ps[i].status));
1081
		if (pipefailflag && status == 0 && jp->ps[i].status != 0) {
1082
			status = jp->ps[i].status;
1083
			TRACE(("waitforjob: setting pipeline exit status to %d"
1084
			    " since -o pipefail is set\n", status));
1085
		}
1086
	}
1087
1079
	if (signaled != NULL)
1088
	if (signaled != NULL)
1080
		*signaled = WIFSIGNALED(status);
1089
		*signaled = WIFSIGNALED(status);
1081
	/* convert to 8 bits */
1090
	/* convert to 8 bits */
(-)b/bin/sh/options.h (-1 / +3 lines)
Lines 67-75 struct shparam { Link Here
67
#define	Pflag optval[17]
67
#define	Pflag optval[17]
68
#define	hflag optval[18]
68
#define	hflag optval[18]
69
#define	nologflag optval[19]
69
#define	nologflag optval[19]
70
#define	pipefailflag optval[20]
70
71
71
#define NSHORTOPTS	19
72
#define NSHORTOPTS	19
72
#define NOPTS		20
73
#define NOPTS		21
73
74
74
extern char optval[NOPTS];
75
extern char optval[NOPTS];
75
extern const char optletter[NSHORTOPTS];
76
extern const char optletter[NSHORTOPTS];
Lines 97-102 static const unsigned char optname[] = Link Here
97
	"\010physical"
98
	"\010physical"
98
	"\010trackall"
99
	"\010trackall"
99
	"\005nolog"
100
	"\005nolog"
101
	"\010pipefail"
100
;
102
;
101
#endif
103
#endif
102
104

Return to bug 224270