shithub: gefs

Download patch

ref: 6daa822ef03349606fc5936fddbb4591f6abae2d
parent: 95162babf731e1e431134879cb21bf5f8110b328
author: Michael Forney <mforney@mforney.org>
date: Tue Mar 22 01:38:58 EDT 2022

fs: respond with zero read from readdir if buffer is too small

This matches the behavior of other filesystems and fixes large
directory listing for v9fs.

--- a/fs.c
+++ b/fs.c
@@ -1529,8 +1529,10 @@
 	p = r->data;
 	n = m->count;
 	if(s->overflow){
-		if((ns = kv2statbuf(&s->kv, p, n)) == -1)
-			return Edscan;
+		if((ns = kv2statbuf(&s->kv, p, n)) == -1){
+			r->count = 0;
+			return nil;
+		}
 		s->overflow = 0;
 		p += ns;
 		n -= ns;