sys/vfs/fuse: Fix confusing vop_write_dirent() retval test
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fri, 5 Apr 2019 20:59:45 +0000 (05:59 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fri, 5 Apr 2019 21:13:45 +0000 (06:13 +0900)
vop_write_dirent() has confusing return value (bug).

When vop_write_dirent() returns non zero, *error is unchanged.
OTOH when vop_write_dirent() returns zero, *error may be non zero.

sys/vfs/fuse/fuse_vnops.c

index e189e0e..bee6470 100644 (file)
@@ -1075,7 +1075,7 @@ fuse_vop_readdir(struct vop_readdir_args *ap)
                        error = 0;
                        if (vop_write_dirent(&error, uio, fde->ino, fde->type,
                            fde->namelen, fde->name))
-                               break;
+                               error = EINVAL;
                        if (error)
                                break;
                        fuse_dbg("ino=%ju type=%d name=%s len=%u\n",