fusefs_link returns the wrong error code when attempting to create a
hard link to a directory. It returns EISDIR when it should instead
return EPERM.  Discovered while running the ffs test suite on ntfs-3g
and confirmed by comparing to ufs.

This is the description for the test that fails:
</usr/src/regress/sys/ffs/tests/link/11.t>

"link returns EPERM if the source file is a directory"

This patch changes the error code to EPERM.

ok?

Index: fuse_vnops.c
===================================================================
RCS file: /cvs/src/sys/miscfs/fuse/fuse_vnops.c,v
retrieving revision 1.35
diff -u -p -u -p -r1.35 fuse_vnops.c
--- fuse_vnops.c        27 Nov 2017 12:54:13 -0000      1.35
+++ fuse_vnops.c        27 Nov 2017 13:49:15 -0000
@@ -565,7 +565,7 @@ fusefs_link(void *v)
        }
        if (vp->v_type == VDIR) {
                VOP_ABORTOP(dvp, cnp);
-               error = EISDIR;
+               error = EPERM;
                goto out2;
        }
        if (dvp->v_mount != vp->v_mount) {

Reply via email to