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.
This commit is contained in:
Xiao-Yong Jin 2018-03-14 20:27:46 -05:00 committed by David du Colombier
parent 4798a8a556
commit 112744e54b

View file

@ -48,7 +48,6 @@ readfusemsg(void)
int n, nn; int n, nn;
m = allocfusemsg(); m = allocfusemsg();
errno = 0;
/* /*
* The FUSE kernel device apparently guarantees * The FUSE kernel device apparently guarantees
* that this read will return exactly one message. * that this read will return exactly one message.
@ -57,7 +56,11 @@ readfusemsg(void)
* FUSE returns an ENODEV error, not EOF, * FUSE returns an ENODEV error, not EOF,
* when the connection is unmounted. * 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) if(errno != ENODEV)
sysfatal("readfusemsg: %r"); sysfatal("readfusemsg: %r");
} }