devproc: check for p->dot == nil, run closeproc with up->dot = up->slash

p->dot can be nil when process exits (see pexit())

set closeprocs dot to up->slash so it will show up
right in devproc.
This commit is contained in:
cinap_lenrek 2013-09-22 19:49:59 +02:00
parent 99167104f9
commit b4cdfc6c55
2 changed files with 3 additions and 3 deletions

View file

@ -535,7 +535,7 @@ closechanq(Chan *c)
if(up != 0 && palloc.Lock.p != up && canqlock(&clunkq.q)){
c = up->dot;
up->dot = nil;
up->dot = up->slash; /* dummy */
if(!waserror()){
kproc("closeproc", closeproc, nil);
poperror();

View file

@ -571,7 +571,7 @@ procfds(Proc *p, char *va, int count, long offset)
eqlock(&p->debug);
f = p->fgrp;
if(f == nil){
if(f == nil || p->dot == nil){
qunlock(&p->debug);
return 0;
}
@ -956,7 +956,7 @@ procread(Chan *c, void *va, long n, vlong off)
qunlock(&p->debug);
nexterror();
}
if(p->pgrp == nil || p->pid != PID(c->qid))
if(p->pgrp == nil || p->dot == nil || p->pid != PID(c->qid))
error(Eprocdied);
mw = c->aux;
if(mw->cddone){