port/chan.c: fix locking issue

This commit is contained in:
cinap_lenrek 2012-03-28 18:11:09 +02:00
parent 6bda7fac86
commit c3004ddf25

View file

@ -1015,15 +1015,15 @@ walk(Chan **cp, char **names, int nnames, int nomount, int *nerror)
* mh->mount->to == c, so start at mh->mount->next * mh->mount->to == c, so start at mh->mount->next
*/ */
rlock(&mh->lock); rlock(&mh->lock);
f = mh->mount; if((f = mh->mount) != nil)
for(f = (f? f->next: f); f; f = f->next) f = f->next;
if((wq = ewalk(f->to, nil, names+nhave, ntry)) != nil) for(; f != nil; f = f->next)
if((wq = ewalk(f->to, nil, names+nhave, ntry)) != nil){
type = f->to->type;
dev = f->to->dev;
break; break;
}
runlock(&mh->lock); runlock(&mh->lock);
if(f != nil){
type = f->to->type;
dev = f->to->dev;
}
} }
if(wq == nil){ if(wq == nil){
cclose(c); cclose(c);
@ -1624,7 +1624,7 @@ if(c->umh != nil){
goto Open; goto Open;
default: default:
panic("unknown namec access %d\n", amode); panic("unknown namec access %d", amode);
} }
/* place final element in genbuf for e.g. exec */ /* place final element in genbuf for e.g. exec */