syscallcompat: getdents: retry on EINTR

Fixes: https://github.com/rfjakob/gocryptfs/issues/483
Related: https://github.com/golang/go/issues/38836
This commit is contained in:
Jakob Unterwurzacher 2020-05-23 22:54:23 +02:00
parent f8ad2ac3e2
commit 25f1727de9
1 changed files with 7 additions and 1 deletions

View File

@ -35,7 +35,13 @@ func getdents(fd int) ([]fuse.DirEntry, error) {
tmp := make([]byte, 10000)
for {
n, err := unix.Getdents(fd, tmp)
if err != nil {
// unix.Getdents has been observed to return EINTR on cifs mounts
if err == unix.EINTR {
if n > 0 {
smartBuf.Write(tmp[:n])
}
continue
} else if err != nil {
return nil, err
}
if n == 0 {