]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
For open("name", O_DIRECTORY | O_CREAT), do not try to create the
authorkib <kib@FreeBSD.org>
Wed, 9 Sep 2015 19:31:08 +0000 (19:31 +0000)
committerkib <kib@FreeBSD.org>
Wed, 9 Sep 2015 19:31:08 +0000 (19:31 +0000)
commit9f66ca5a18044d8a9d62557455d63fcf6e9a88f8
tree5f8a291f9d15bc0195612b1118ac92c1dffab01d
parent1f333be9cdbfb802d8be7ce5ed17fb9b01706823
For open("name", O_DIRECTORY | O_CREAT), do not try to create the
named node, open(2) cannot create directories.  But do allow the flag
combination to succeed if the directory already exists.

Declare the open("name", O_DIRECTORY | O_CREAT | O_EXCL) always
invalid for the same reason, since open(2) cannot create directory.

Note that there is an argument that O_DIRECTORY | O_CREAT should be
invalid always, regardless of the target directory existence or
O_EXCL.  The current fix is conservative and allows the call to
succeed in the situation where it succeeded before the patch.

Reported by: Tom Ridge <freebsd@tom-ridge.com>
Reviewed by: rwatson
PR:  202892
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/kern/vfs_vnops.c