git: kernel - Fix improper error on certain O_EXCL open() operations
Matthew Dillon
dillon at crater.dragonflybsd.org
Sun Feb 4 15:04:44 PST 2024
commit 038b596b339f171e591aae50683c27da49cde8d2
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date: Sun Feb 4 14:59:41 2024 -0800
kernel - Fix improper error on certain O_EXCL open() operations
* O_EXCL|O_CREAT open()s were converting EACCES to EEXIST without
determining whether the error was due to an interemdiate directory
component. In fact it needs to return the error caused by the
intermediate directory component.
EACCES is only converted to EEXIST by an O_EXCL|O_CREAT open()
when the error is caused by the last component of the path.
Because in that case the last component does in fact exist and
it is not relevant whether it is accessible or not.
* Fix by specifying whether the error came from an intermediate
directory check using a previously unused field in struct
nlookupdata. A bit messy bit this was the easiest way since
we've run out of NLC flag bits.
Reported-by: tuxillo
Summary of changes:
sys/kern/vfs_nlookup.c | 28 +++++++++++++++++++---------
sys/kern/vfs_vnops.c | 3 ++-
sys/sys/nlookup.h | 2 +-
3 files changed, 22 insertions(+), 11 deletions(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/038b596b339f171e591aae50683c27da49cde8d2
--
DragonFly BSD source repository
More information about the Commits
mailing list