mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-13 14:53:34 +00:00
[sys/linux]: Fix creat(2) syscall not returning file descriptor
This commit is contained in:
@@ -1209,12 +1209,12 @@ rmdir :: proc "contextless" (name: cstring) -> (Errno) {
|
||||
Available since Linux 1.0.
|
||||
On ARM64 available since Linux 2.6.16.
|
||||
*/
|
||||
creat :: proc "contextless" (name: cstring, mode: Mode) -> (Errno) {
|
||||
creat :: proc "contextless" (name: cstring, mode: Mode) -> (Fd, Errno) {
|
||||
when ODIN_ARCH == .arm64 {
|
||||
return openat(AT_FDCWD, name, {.CREAT, .WRONLY,.TRUNC}, mode)
|
||||
} else {
|
||||
ret := syscall(SYS_creat, cast(rawptr) name, transmute(u32) mode)
|
||||
return Errno(-ret)
|
||||
return errno_unwrap(ret, Fd)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user