Skip to content

Commit 8725f7c

Browse files
committed
FIXUP: invert booleans
1 parent 24f981a commit 8725f7c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

System/Posix/Fcntl.hsc

+3-3
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ fileGetCaching :: Fd -> IO Bool
135135
#if HAVE_O_DIRECT
136136
fileGetCaching (Fd fd) = do
137137
r <- throwErrnoIfMinus1 "fileGetCaching" (c_fcntl_read fd #{const F_GETFL})
138-
return ((r .&. opt_val) /= 0)
138+
return ((r .&. opt_val) == 0)
139139
where
140140
opt_val = #{const O_DIRECT}
141141
#else
@@ -164,8 +164,8 @@ fileSetCaching :: Fd -> Bool -> IO ()
164164
#if HAVE_O_DIRECT
165165
fileSetCaching (Fd fd) val = do
166166
r <- throwErrnoIfMinus1 "fileSetCaching" (c_fcntl_read fd #{const F_GETFL})
167-
let r' | val = fromIntegral r .|. opt_val
168-
| otherwise = fromIntegral r .&. complement opt_val
167+
let r' | val = fromIntegral r .&. complement opt_val
168+
| otherwise = fromIntegral r .|. opt_val
169169
throwErrnoIfMinus1_ "fileSetCaching" (c_fcntl_write fd #{const F_SETFL} r')
170170
where
171171
opt_val = #{const O_DIRECT}

0 commit comments

Comments
 (0)