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,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to