diff options
author | Michael Teichgräber <mt4swm@googlemail.com> | 2009-08-08 16:27:01 -0400 |
---|---|---|
committer | Michael Teichgräber <mt4swm@googlemail.com> | 2009-08-08 16:27:01 -0400 |
commit | 74be46038de399f5d5ba48bef15a3b649b883967 (patch) | |
tree | 21e7797ec60c75e3c82c83e77fceb13909051057 /src/cmd/rc | |
parent | 1d534ed6ceb13aa90fea2d0889bdb28ff946ac8d (diff) | |
download | plan9port-74be46038de399f5d5ba48bef15a3b649b883967.tar.gz plan9port-74be46038de399f5d5ba48bef15a3b649b883967.tar.bz2 plan9port-74be46038de399f5d5ba48bef15a3b649b883967.zip |
rc: fix segfault when SIGINT is received
Save the value of `runq' at the start of the function, so that the `pc'
update
at the end does work on that original value, and not on a probably
modified
value of `runq'.
fixes #14 http://code.swtch.com/plan9port/issue/14/
http://codereview.appspot.com/104066
Diffstat (limited to 'src/cmd/rc')
-rw-r--r-- | src/cmd/rc/havefork.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/rc/havefork.c b/src/cmd/rc/havefork.c index 45419f0d..62d52c2c 100644 --- a/src/cmd/rc/havefork.c +++ b/src/cmd/rc/havefork.c @@ -110,6 +110,7 @@ Xpipe(void) void Xbackq(void) { + struct thread *p = runq; char wd[8193]; int c; char *s, *ewd=&wd[8192], *stop; @@ -164,7 +165,7 @@ Xbackq(void) runq->argv->words = v; v = nextv; } - runq->pc = runq->code[runq->pc].i; + p->pc = p->code[p->pc].i; return; } } |