git: kern: Fix write-open "." or ".." to return EISDIR instead of EEXIST
Aaron LI
aly at crater.dragonflybsd.org
Sun Oct 4 06:11:51 PDT 2026
commit d5838e7c8154895375e3f278fa0c03a2b913132c
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/d5838e7c8154895375e3f278fa0c03a2b913132c
--
DragonFly BSD source repository
More information about the Commits
mailing list