svn commit: r286670 - head/sys/kern

Ed Schouten ed at FreeBSD.org
Wed Aug 12 16:17:01 UTC 2015


Author: ed
Date: Wed Aug 12 16:17:00 2015
New Revision: 286670
URL: https://svnweb.freebsd.org/changeset/base/286670

Log:
  Properly return ENOTDIR when calling *at() on a non-vnode.
  
  We already properly return ENOTDIR when calling *at() on a non-directory
  vnode, but it turns out that if you call it on a socket, we see EINVAL.
  Patch up namei to properly translate this to ENOTDIR.

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Wed Aug 12 16:08:37 2015	(r286669)
+++ head/sys/kern/vfs_lookup.c	Wed Aug 12 16:17:00 2015	(r286670)
@@ -269,6 +269,8 @@ namei(struct nameidata *ndp)
 				AUDIT_ARG_ATFD2(ndp->ni_dirfd);
 			error = fgetvp_rights(td, ndp->ni_dirfd,
 			    &rights, &ndp->ni_filecaps, &dp);
+			if (error == EINVAL)
+				error = ENOTDIR;
 #ifdef CAPABILITIES
 			/*
 			 * If file descriptor doesn't have all rights,


More information about the svn-src-all mailing list