Page MenuHomeFreeBSD

D21634.id62029.diff
No OneTemporary

D21634.id62029.diff

Index: lib/libc/sys/open.2
===================================================================
--- lib/libc/sys/open.2
+++ lib/libc/sys/open.2
@@ -419,6 +419,11 @@
.It Bq Er EISDIR
The named file is a directory, and the arguments specify
it is to be modified.
+.It Bq Er EISDIR
+The named file is a directory, and the flags specified
+.Dv O_CREAT
+without
+.Dv O_DIRECTORY .
.It Bq Er EROFS
The named file resides on a read-only file system,
and the file is to be modified.
Index: sys/kern/vfs_vnops.c
===================================================================
--- sys/kern/vfs_vnops.c
+++ sys/kern/vfs_vnops.c
@@ -343,14 +343,17 @@
return (EMLINK);
if (vp->v_type == VSOCK)
return (EOPNOTSUPP);
- if (vp->v_type != VDIR && fmode & O_DIRECTORY)
- return (ENOTDIR);
- accmode = 0;
- if (fmode & (FWRITE | O_TRUNC)) {
- if (vp->v_type == VDIR)
+ if (vp->v_type == VDIR) {
+ if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT ||
+ (fmode & (FWRITE | O_TRUNC)) != 0)
return (EISDIR);
- accmode |= VWRITE;
+ } else {
+ if ((fmode & O_DIRECTORY) != 0)
+ return (ENOTDIR);
}
+ accmode = 0;
+ if ((fmode & (FWRITE | O_TRUNC)) != 0)
+ accmode |= VWRITE;
if (fmode & FREAD)
accmode |= VREAD;
if (fmode & FEXEC)

File Metadata

Mime Type
text/plain
Expires
Sun, Jul 19, 10:19 AM (19 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35230752
Default Alt Text
D21634.id62029.diff (1 KB)

Event Timeline