gefs: fix error handling in readsnap()

This commit is contained in:
Ori Bernstein 2024-12-26 00:46:07 +00:00
parent d4938f099d
commit 0bfa3ffcb4

View file

@ -2026,7 +2026,7 @@ readsnap(Fmsg *m, Fid *f, Fcall *r)
} }
if(s->donescan){ if(s->donescan){
r->count = 0; r->count = 0;
return; goto Out;
} }
p = r->data; p = r->data;
n = m->count; n = m->count;
@ -2037,7 +2037,7 @@ readsnap(Fmsg *m, Fid *f, Fcall *r)
d.qid.path = UNPACK64(s->kv.v + 1); d.qid.path = UNPACK64(s->kv.v + 1);
if((ns = dir2statbuf(&d, p, n)) == -1){ if((ns = dir2statbuf(&d, p, n)) == -1){
r->count = 0; r->count = 0;
return; goto Out;
} }
s->overflow = 0; s->overflow = 0;
p += ns; p += ns;
@ -2058,9 +2058,11 @@ readsnap(Fmsg *m, Fid *f, Fcall *r)
n -= ns; n -= ns;
} }
btexit(s); btexit(s);
r->count = p - r->data;
Out:
poperror(); poperror();
wunlock(f); wunlock(f);
r->count = p - r->data;
return; return;
} }