Skip to content

Commit

Permalink
Fix OSX build and incorrect treatment of errors from Syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
ncw committed Nov 28, 2012
1 parent a67752c commit cd5de9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions direct_io_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func OpenFile(name string, flag int, perm os.FileMode) (file *os.File, err error
// Set F_NOCACHE to avoid caching
// F_NOCACHE Turns data caching off/on. A non-zero value in arg turns data caching off. A value
// of zero in arg turns data caching on.
_, _, err = syscall.Syscall(syscall.SYS_FCNTL, uintptr(file.Fd()), syscall.F_NOCACHE, 1)
if err != nil {
fmt.Errorf("Failed to set F_NOCACHE: %s", err)
_, _, e1 := syscall.Syscall(syscall.SYS_FCNTL, uintptr(file.Fd()), syscall.F_NOCACHE, 1)
if e1 != 0 {
err = fmt.Errorf("Failed to set F_NOCACHE: %s", e1)
file.Close()
file = nil
}
Expand Down

0 comments on commit cd5de9e

Please sign in to comment.