git: DragonFly_RELEASE_6_4 kern: Fix write-open "." or ".." to return EISDIR instead of EEXIST

Aaron LI aly at crater.dragonflybsd.org
Sun Oct 4 06:12:26 PDT 2026


commit 72d8339092558a7b5b21aff6b0cff9ed04c93312
Author: jpipkin <jacob.pipkin at icloud.com>
Date:   Sun Oct 4 15:13:21 2026 +0800

    kern: Fix write-open "." or ".." to return EISDIR instead of EEXIST
    
    Before the fix, opening "." or ".." for write would return EEXIST, which
    was incorrect per the POSIX spec:
    
    https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
    
    where one would expect one of EISDIR, EINVAL, EACCES.
    
    For example:
    
    ```
    % sh -c 'echo xxx > /tmp/.'
    sh: cannot create /tmp/.: File exists
    ```
    
    Fix the code to return EISDIR.  Note that opening a directory other than
    "." or ".." for write already returns EISDIR, e.g.,
    
    ```
    % sh -c 'echo xxx > /tmp'
    sh: cannot create /tmp: Is a directory
    ```
    
    Bug: https://bugs.dragonflybsd.org/issues/3282

Summary of changes:
 sys/kern/vfs_nlookup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/72d8339092558a7b5b21aff6b0cff9ed04c93312


-- 
DragonFly BSD source repository


More information about the Commits mailing list