os: fix create()

pull/3295/head
Alexander Medvednikov 2020-01-01 12:57:27 +01:00
parent 47908c22df
commit b7663848ef
1 changed files with 4 additions and 2 deletions

View File

@ -99,12 +99,14 @@ pub fn create(path string) ?File {
//$if linux_or_macos { //$if linux_or_macos {
mut fd := 0 mut fd := 0
//println('creat SYS') //println('creat SYS')
/*
$if macos { $if macos {
fd = C.syscall(sys_open_nocancel, path.str, 0x601, 0x1b6) fd = C.syscall(sys_open_nocancel, path.str, 0x601, 0x1b6)
} }
$else { $else {
fd = C.syscall(sys_creat, path.str, 511) */
} fd = C.syscall(sys_creat, path.str, 511)
//}
//println('fd=$fd') //println('fd=$fd')
if fd == -1 { if fd == -1 {
return error('failed to create file "$path"') return error('failed to create file "$path"')