fix #17888: remove undefined behavior for posix.open; fix tempfiles.createTempFile (#17889)

* fix #17888: remove undefined behavior for posix.open; fix tempfiles.createTempFile

* fix for tests/async/tasyncfile.nim

* hide mode for now

* add notice regarding stability
This commit is contained in:
Timothee Cour
2021-04-29 04:42:56 -07:00
committed by GitHub
parent 5edddd68d0
commit e4db733d80
3 changed files with 16 additions and 4 deletions

View File

@@ -183,7 +183,11 @@ proc dlsym*(a1: pointer, a2: cstring): pointer {.importc, header: "<dlfcn.h>", s
proc creat*(a1: cstring, a2: Mode): cint {.importc, header: "<fcntl.h>", sideEffect.}
proc fcntl*(a1: cint | SocketHandle, a2: cint): cint {.varargs, importc, header: "<fcntl.h>", sideEffect.}
proc open*(a1: cstring, a2: cint): cint {.varargs, importc, header: "<fcntl.h>", sideEffect.}
proc openImpl(a1: cstring, a2: cint): cint {.varargs, importc: "open", header: "<fcntl.h>", sideEffect.}
proc open*(a1: cstring, a2: cint, mode: Mode | cint = 0.Mode): cint {.inline.} =
# prevents bug #17888
openImpl(a1, a2, mode)
proc posix_fadvise*(a1: cint, a2, a3: Off, a4: cint): cint {.
importc, header: "<fcntl.h>".}
proc posix_fallocate*(a1: cint, a2, a3: Off): cint {.