commit 74be46038de399f5d5ba48bef15a3b649b883967 from: Michael Teichgräber date: Sat Aug 08 20:27:01 2009 UTC 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 commit - 1d534ed6ceb13aa90fea2d0889bdb28ff946ac8d commit + 74be46038de399f5d5ba48bef15a3b649b883967 blob - 45419f0d17e69478529635479c006b3f18f0dbc2 blob + 62d52c2cf37913abd714912f0b2e7540461583f2 --- src/cmd/rc/havefork.c +++ 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; } }