Author: kib
Date: Wed Sep 16 04:23:08 2015
New Revision: 287847
URL: https://svnweb.freebsd.org/changeset/base/287847

Log:
  MFC r287599:
  Correct handling of open("name", O_DIRECTORY | O_CREAT).
  
  PR:   202892

Modified:
  stable/10/sys/kern/vfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/vfs_vnops.c
==============================================================================
--- stable/10/sys/kern/vfs_vnops.c      Wed Sep 16 04:20:39 2015        
(r287846)
+++ stable/10/sys/kern/vfs_vnops.c      Wed Sep 16 04:23:08 2015        
(r287847)
@@ -188,7 +188,10 @@ vn_open_cred(struct nameidata *ndp, int 
 
 restart:
        fmode = *flagp;
-       if (fmode & O_CREAT) {
+       if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT |
+           O_EXCL | O_DIRECTORY))
+               return (EINVAL);
+       else if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT) {
                ndp->ni_cnd.cn_nameiop = CREATE;
                /*
                 * Set NOCACHE to avoid flushing the cache when
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to