readdir(somefile) returing inconsistent errors

Jille Timmermans jille at quis.cx
Thu Sep 11 19:56:31 UTC 2008


Hello,

I was looking through some vop_readdir()'s, and noticed an inconsistency
between (at least) xfs and unionfs.

sys/fs/unionfs/union_vnops.c:1410:
	if(ap->a_vp->v_type != VDIR)
		return (ENOTDIR);

sys/fs/xfs/FreeBSD/xfs_vnops.c:1001:
	if(vp->v_type != VDIR)
		return (EPERM);

A little userland script gave me a ENOTDIR when trying to
opendir(somefile) (userspace opendir() calling kernelspace readdir()).

So I assume the check is made earlier, but shouldn't the xfs code return
ENOTDIR in this case ?
due to the if-clause above it, you'd say ENOTDIR seems better than EPERM.


-- Jille


More information about the freebsd-hackers mailing list