mirror of
https://github.com/golang/go
synced 2024-11-25 09:37:56 -07:00
syscall: add O_DIRECTORY for wasip1
Change-Id: Iadd69360fb09714a280c4dae26639834df28a7dc Reviewed-on: https://go-review.googlesource.com/c/go/+/606659 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
f0f4e2d0af
commit
c5a9c8d067
@ -542,6 +542,14 @@ func Open(path string, openmode int, perm uint32) (int, error) {
|
||||
rights = fileRights
|
||||
}
|
||||
|
||||
if (openmode & O_DIRECTORY) != 0 {
|
||||
if openmode&(O_WRONLY|O_RDWR) != 0 {
|
||||
return -1, EISDIR
|
||||
}
|
||||
oflags |= OFLAG_DIRECTORY
|
||||
rights &= dirRights
|
||||
}
|
||||
|
||||
var fdflags fdflags
|
||||
if (openmode & O_APPEND) != 0 {
|
||||
fdflags |= FDFLAG_APPEND
|
||||
|
@ -216,12 +216,13 @@ const (
|
||||
O_WRONLY = 1
|
||||
O_RDWR = 2
|
||||
|
||||
O_CREAT = 0100
|
||||
O_CREATE = O_CREAT
|
||||
O_TRUNC = 01000
|
||||
O_APPEND = 02000
|
||||
O_EXCL = 0200
|
||||
O_SYNC = 010000
|
||||
O_CREAT = 0100
|
||||
O_CREATE = O_CREAT
|
||||
O_TRUNC = 01000
|
||||
O_APPEND = 02000
|
||||
O_EXCL = 0200
|
||||
O_SYNC = 010000
|
||||
O_DIRECTORY = 020000
|
||||
|
||||
O_CLOEXEC = 0
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user