git: open(2): Fix open(O_CREAT) to correctly return EISDIR

Aaron LI aly at crater.dragonflybsd.org
Tue Nov 17 01:30:56 PST 2026


commit 325bdd30e27948c41999f6494309f09219c80aea
Author: Aaron LI <aly at aaronly.me>
Date:   Sun Nov 8 00:11:45 2026 +0800

    open(2): Fix open(O_CREAT) to correctly return EISDIR
    
    * Skip "." and ".." terminating paths in nlookup() for NLC_OPEN, so
      they'll be handled in vn_open() to correctly return EISDIR instead of
      EEXIST.
    
    * Let open("/", O_CREAT) through in nlookup(), so this case can be
      handled in vn_open() to return EISDIR.
    
    * Fix vn_open() to return EISDIR if the target is a directory and is
      opened with O_CREAT or O_RDWR/O_TRUNC.
    
    * Fix vn_open() to handle the mount-point target normally when the
      target already exists, instead of simply return EINVAL.
    
    Bug: https://bugs.dragonflybsd.org/issues/3282
    Tested-by: pjdfstest (https://github.com/pjd/pjdfstest)
    Assisted-by: DeepSeek-v4.1-flash (with Pi Coding Agent)

Summary of changes:
 sys/kern/vfs_nlookup.c | 18 ++++++++++++++----
 sys/kern/vfs_vnops.c   | 24 ++++++++++++++++++------
 2 files changed, 32 insertions(+), 10 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/325bdd30e27948c41999f6494309f09219c80aea


-- 
DragonFly BSD source repository


More information about the Commits mailing list