summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/chan.c15
-rw-r--r--sys/src/9/port/devmnt.c7
2 files changed, 14 insertions, 8 deletions
diff --git a/sys/src/9/port/chan.c b/sys/src/9/port/chan.c
index 7f91578e6..d49301201 100644
--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -225,20 +225,19 @@ newchan(void)
lock(&chanalloc);
c = chanalloc.free;
- if(c != 0){
+ if(c != nil){
chanalloc.free = c->next;
- c->next = 0;
- }
- unlock(&chanalloc);
-
- if(c == nil){
+ c->next = nil;
+ } else {
+ unlock(&chanalloc);
c = smalloc(sizeof(Chan));
lock(&chanalloc);
- c->fid = ++chanalloc.fid;
c->link = chanalloc.list;
chanalloc.list = c;
- unlock(&chanalloc);
}
+ if(c->fid == 0)
+ c->fid = ++chanalloc.fid;
+ unlock(&chanalloc);
/* if you get an error before associating with a dev,
close calls rootclose, a nop */
diff --git a/sys/src/9/port/devmnt.c b/sys/src/9/port/devmnt.c
index 926b6ee61..d073b7064 100644
--- a/sys/src/9/port/devmnt.c
+++ b/sys/src/9/port/devmnt.c
@@ -777,6 +777,13 @@ mountio(Mnt *m, Mntrpc *r)
if(m->rip == up)
mntgate(m);
if(strcmp(up->errstr, Eintr) != 0){
+ switch(r->request.type){
+ case Tremove:
+ case Tclunk:
+ /* botch, abandon fid */
+ if(strcmp(up->errstr, Ehungup) != 0)
+ r->c->fid = 0;
+ }
mntflushfree(m, r);
nexterror();
}