Fix OpenFile call flags for macos
This commit is contained in:
parent
c6c779da39
commit
94e7d81bd3
3 changed files with 19 additions and 3 deletions
|
@ -10,7 +10,6 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/lbryio/reflector.go/shared"
|
||||
|
@ -138,8 +137,7 @@ func (d *DiskStore) Put(hash string, blob stream.Blob) error {
|
|||
}
|
||||
|
||||
// Open file with O_DIRECT
|
||||
flags := os.O_WRONLY | os.O_CREATE | syscall.O_DIRECT
|
||||
f, err := os.OpenFile(d.tmpPath(hash), flags, 0644)
|
||||
f, err := os.OpenFile(d.tmpPath(hash), openFileFlags, 0644)
|
||||
if err != nil {
|
||||
return errors.Err(err)
|
||||
}
|
||||
|
|
9
store/flags_darwin.go
Normal file
9
store/flags_darwin.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
// +build darwin
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var openFileFlags = os.O_WRONLY | os.O_CREATE
|
9
store/flags_linux.go
Normal file
9
store/flags_linux.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
// +build linux
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var openFileFlags = os.O_WRONLY | os.O_CREATE | syscall.O_DIRECT
|
Loading…
Reference in a new issue