plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit f8681acb374fa0d5ed1568dbedb00a4abe1ca6f1
parent 3a877764da1fcfe981d4d9696621cbee2655e55a
Author: fgergo <fgergo@gmail.com>
Date:   Sat, 30 Dec 2023 14:58:44 +0100

ramfs: update to work

ramfs: update to work

erealloc(p, 0) is handled correctly
removed fprint(2, ...
removed assert()
Diffstat:
Msrc/cmd/ramfs.c | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/cmd/ramfs.c b/src/cmd/ramfs.c @@ -368,13 +368,11 @@ rwalk(Fid *f) } if(nf != nil && (err!=nil || rhdr.nwqid<thdr.nwname)){ /* clunk the new fid, which is the one we walked */ -fprint(2, "f %d zero busy\n", f->fid); f->busy = 0; f->ram = nil; } if(rhdr.nwqid == thdr.nwname) /* update the fid after a successful walk */ f->ram = fram; - assert(f->busy); return err; } @@ -615,8 +613,6 @@ rclunk(Fid *f) f->ram->open--; if(f->rclose) e = realremove(f->ram); -fprint(2, "clunk fid %d busy=%d\n", f->fid, f->busy); -fprint(2, "f %d zero busy\n", f->fid); f->busy = 0; f->open = 0; f->ram = 0; @@ -630,7 +626,6 @@ rremove(Fid *f) if(f->open) f->ram->open--; -fprint(2, "f %d zero busy\n", f->fid); f->busy = 0; f->open = 0; r = f->ram; @@ -874,6 +869,10 @@ emalloc(ulong n) void * erealloc(void *p, ulong n) { + if(n == 0) { + free(p); + return nil; + } p = realloc(p, n); if(!p) error("out of memory");