From 0bfa3ffcb484e1ca4e78374339f195405dad2f5e Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Thu, 26 Dec 2024 00:46:07 +0000 Subject: [PATCH] gefs: fix error handling in readsnap() --- sys/src/cmd/gefs/fs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/src/cmd/gefs/fs.c b/sys/src/cmd/gefs/fs.c index 9b91e450a..b70c35d25 100644 --- a/sys/src/cmd/gefs/fs.c +++ b/sys/src/cmd/gefs/fs.c @@ -2026,7 +2026,7 @@ readsnap(Fmsg *m, Fid *f, Fcall *r) } if(s->donescan){ r->count = 0; - return; + goto Out; } p = r->data; n = m->count; @@ -2037,7 +2037,7 @@ readsnap(Fmsg *m, Fid *f, Fcall *r) d.qid.path = UNPACK64(s->kv.v + 1); if((ns = dir2statbuf(&d, p, n)) == -1){ r->count = 0; - return; + goto Out; } s->overflow = 0; p += ns; @@ -2058,9 +2058,11 @@ readsnap(Fmsg *m, Fid *f, Fcall *r) n -= ns; } btexit(s); + r->count = p - r->data; + +Out: poperror(); wunlock(f); - r->count = p - r->data; return; }