https://bugzilla.cyrusimap.org/show_bug.cgi?id=3920 --- saslauthd/auth_rimap.orig 2016-02-19 21:55:07.000000000 -0500 +++ saslauthd/auth_rimap.c 2016-02-19 21:55:36.000000000 -0500 @@ -383,7 +383,7 @@ while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) { if ( FD_ISSET(s, &perm) ) { ret = read(s, rbuf+rc, sizeof(rbuf)-rc); - if ( ret<0 ) { + if ( ret<=0 ) { rc = ret; break; } else { @@ -496,7 +496,7 @@ while( select (fds, &perm, NULL, NULL, &timeout ) >0 ) { if ( FD_ISSET(s, &perm) ) { ret = read(s, rbuf+rc, sizeof(rbuf)-rc); - if ( ret<0 ) { + if ( ret<=0 ) { rc = ret; break; } else {