diff options
author | rsc <devnull@localhost> | 2004-05-14 15:14:21 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-05-14 15:14:21 +0000 |
commit | 1a8f27c35024af7b4ed857a388d20f0a4a560db0 (patch) | |
tree | b70f33150772d665fd2c254655b2782289b0c9da /src/libfs | |
parent | a796abef1632f379ced703b1b2e691d8f63436e2 (diff) | |
download | plan9port-1a8f27c35024af7b4ed857a388d20f0a4a560db0.tar.gz plan9port-1a8f27c35024af7b4ed857a388d20f0a4a560db0.tar.bz2 plan9port-1a8f27c35024af7b4ed857a388d20f0a4a560db0.zip |
various bug fixes
Diffstat (limited to 'src/libfs')
-rw-r--r-- | src/libfs/fs.c | 14 | ||||
-rw-r--r-- | src/libfs/ns.c | 3 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/libfs/fs.c b/src/libfs/fs.c index 31515250..a42af96b 100644 --- a/src/libfs/fs.c +++ b/src/libfs/fs.c @@ -86,19 +86,27 @@ fsunmount(Fsys *fs) void _fsdecref(Fsys *fs) { - Fid *f, *next; + Fid *f, **l, *next; qlock(&fs->lk); --fs->ref; //fprint(2, "fsdecref %p to %d\n", fs, fs->ref); if(fs->ref == 0){ close(fs->fd); + /* trim the list down to just the first in each chunk */ + for(l=&fs->freefid; *l; ){ + if((*l)->fid%Fidchunk == 0) + l = &(*l)->next; + else + *l = (*l)->next; + } + /* now free the list */ for(f=fs->freefid; f; f=next){ next = f->next; - if(f->fid%Fidchunk == 0) - free(f); + free(f); } free(fs); + return; } qunlock(&fs->lk); } diff --git a/src/libfs/ns.c b/src/libfs/ns.c index 28c9d1cf..763080ba 100644 --- a/src/libfs/ns.c +++ b/src/libfs/ns.c @@ -23,8 +23,11 @@ nsmount(char *name, char *aname) fd = dial(addr, 0, 0, 0); if(fd < 0){ werrstr("dial %s: %r", addr); + free(addr); return nil; } + free(addr); + fcntl(fd, F_SETFL, FD_CLOEXEC); fs = fsmount(fd, aname); |