Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144471299
D53793.1774828299.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D53793.1774828299.diff
View Options
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -1078,6 +1078,7 @@
#if JOBS
int propagate_int = jp->jobctl && jp->foreground;
#endif
+ int jobindex;
int status;
int st;
@@ -1085,8 +1086,11 @@
TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
while (jp->state == 0)
if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG |
- DOWAIT_SIG_TRAP : 0), jp) == -1)
+ DOWAIT_SIG_TRAP : 0), jp) == -1) {
+ jobindex = jp - jobtab;
dotrap();
+ jp = jobtab + jobindex;
+ }
#if JOBS
if (jp->jobctl) {
if (ttyfd >= 0 && tcsetpgrp(ttyfd, rootpid) < 0)
diff --git a/bin/sh/tests/execution/Makefile b/bin/sh/tests/execution/Makefile
--- a/bin/sh/tests/execution/Makefile
+++ b/bin/sh/tests/execution/Makefile
@@ -18,6 +18,7 @@
${PACKAGE}FILES+= bg11.0
${PACKAGE}FILES+= bg12.0
${PACKAGE}FILES+= bg13.0
+${PACKAGE}FILES+= bg14.0
${PACKAGE}FILES+= env1.0
${PACKAGE}FILES+= fork1.0
${PACKAGE}FILES+= fork2.0
diff --git a/bin/sh/tests/execution/bg14.0 b/bin/sh/tests/execution/bg14.0
new file mode 100644
--- /dev/null
+++ b/bin/sh/tests/execution/bg14.0
@@ -0,0 +1,9 @@
+T=`mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXXXX`
+trap 'rm -rf "$T"' 0
+cd "$T" || exit 3
+mkfifo fifo1 || exit 3
+set -T
+trap "for i in 1 2 3 4; do sleep 1 & done" USR1
+sleep 1 &
+{ kill -USR1 "$$"; echo .; } >fifo1 &
+(read dummy <fifo1)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 29, 11:51 PM (2 m, 26 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28226759
Default Alt Text
D53793.1774828299.diff (1 KB)
Attached To
Mode
D53793: sh: Fix job pointer invalidation with trapsasync
Attached
Detach File
Event Timeline
Log In to Comment