commit 112744e54bfdab025bd2146457f41f1f8f4a903b
parent 4798a8a5560552480efde5fe8b1f7963a25a96d3
Author: Xiao-Yong Jin <xjin@anl.gov>
Date: Wed, 14 Mar 2018 20:27:46 -0500
9pfuse: retries read(3) upon EINTR
read(3) sometimes errors with EINTR on macOS over slow connections.
9pfuse(1) now retries read(3) instead of sysfatal(3)ing.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
@@ -48,7 +48,6 @@ readfusemsg(void)
int n, nn;
m = allocfusemsg();
- errno = 0;
/*
* The FUSE kernel device apparently guarantees
* that this read will return exactly one message.
@@ -57,7 +56,11 @@ readfusemsg(void)
* FUSE returns an ENODEV error, not EOF,
* when the connection is unmounted.
*/
- if((n = read(fusefd, m->buf, fusebufsize)) < 0){
+ do{
+ errno = 0;
+ n = read(fusefd, m->buf, fusebufsize);
+ }while(n < 0 && errno == EINTR);
+ if(n < 0){
if(errno != ENODEV)
sysfatal("readfusemsg: %r");
}