t9pfuse: retries read(3) upon EINTR - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 112744e54bfdab025bd2146457f41f1f8f4a903b
 (DIR) parent 4798a8a5560552480efde5fe8b1f7963a25a96d3
 (HTM) 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:
         M src/cmd/9pfuse/fuse.c               |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/9pfuse/fuse.c b/src/cmd/9pfuse/fuse.c
       t@@ -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.
       t@@ -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");
                }