Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115580587
D48332.id148852.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D48332.id148852.diff
View Options
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1185,7 +1185,7 @@
* except O_EXEC is ignored.
*/
if ((flags & O_PATH) != 0) {
- flags &= ~(O_CREAT | O_ACCMODE);
+ flags &= ~O_ACCMODE;
} else if ((flags & O_EXEC) != 0) {
if (flags & O_ACCMODE)
return (EINVAL);
diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c
--- a/tests/sys/file/path_test.c
+++ b/tests/sys/file/path_test.c
@@ -684,10 +684,14 @@
size_t page_size;
int error, fd, pathfd, sd[2];
- /* It shouldn't be possible to create new files with O_PATH. */
+ /* It is allowed to create new files with O_PATH. */
snprintf(path, sizeof(path), "path_io.XXXXXX");
ATF_REQUIRE_MSG(mktemp(path) == path, FMT_ERR("mktemp"));
- ATF_REQUIRE_ERRNO(ENOENT, open(path, O_PATH | O_CREAT, 0600) < 0);
+ pathfd = open(path, O_PATH | O_CREAT, 0600);
+ ATF_REQUIRE_MSG(pathfd >= 0, FMT_ERR("open(O_PATH|O_CREAT)"));
+ /* Ensure that this is indeed O_PATH fd */
+ ATF_REQUIRE_ERRNO(EBADF, write(pathfd, path, strlen(path)) == -1);
+ CHECKED_CLOSE(pathfd);
/* Create a non-empty file for use in the rest of the tests. */
mktfile(path, "path_io.XXXXXX");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 26, 3:03 PM (2 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17805994
Default Alt Text
D48332.id148852.diff (1 KB)
Attached To
Mode
D48332: open(2): allow O_PATH | O_CREAT
Attached
Detach File
Event Timeline
Log In to Comment