ref: b249467798a8c4a681f02ddfc383447eb566b060
parent: 4380944405e2ee7e61db89fa245e50e532d90747
author: kvik <kvik@a-b.xyz>
date: Thu May 16 15:29:46 EDT 2019
dirread in chunks instead of all at once with dirreadall
--- a/unionfs.c
+++ b/unionfs.c
@@ -483,17 +483,18 @@
if((fd = open(path, OREAD)) < 0)
goto err;
free(path);
- n = dirreadall(fd, &dir);
- close(fd);
- if(n < 0)
- continue;
- for(i = 0; i < n; i++){
- if(u->prev != unionlist && fthas(ft, dir[i].name))
- continue;
- f = filenew(&dir[i]);
- ftadd(ft, f);
+ while((n = dirread(fd, &dir)) > 0){
+ for(i = 0; i < n; i++){
+ if(u->prev != unionlist && fthas(ft, dir[i].name))
+ continue;
+ f = filenew(&dir[i]);
+ ftadd(ft, f);
+ }
+ free(dir);
}
- free(dir);
+ if(n < 0)
+ fprint(2, "dirread: %r\n");
+ close(fd);
}
return ft;
}