X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FPosix%2FInternals.hs;h=31b4fff755ed164d450fd37ae8a2f5defe05a9fe;hb=072850565fab361eb7b97ed37b8cdd078e45dd26;hp=10fa3d2a398883dcb988be0cbd9b9ff6ea79a060;hpb=8ea4138dd177524ef650e5be230a19bcd203f681;p=ghc-base.git diff --git a/System/Posix/Internals.hs b/System/Posix/Internals.hs index 10fa3d2..31b4fff 100644 --- a/System/Posix/Internals.hs +++ b/System/Posix/Internals.hs @@ -321,12 +321,12 @@ setNonBlockingFD :: FD -> Bool -> IO () setNonBlockingFD fd set = do flags <- throwErrnoIfMinus1Retry "setNonBlockingFD" (c_fcntl_read fd const_f_getfl) - -- An error when setting O_NONBLOCK isn't fatal: on some systems - -- there are certain file handles on which this will fail (eg. /dev/null - -- on FreeBSD) so we throw away the return code from fcntl_write. let flags' | set = flags .|. o_NONBLOCK | otherwise = flags .&. complement o_NONBLOCK unless (flags == flags') $ do + -- An error when setting O_NONBLOCK isn't fatal: on some systems + -- there are certain file handles on which this will fail (eg. /dev/null + -- on FreeBSD) so we throw away the return code from fcntl_write. _ <- c_fcntl_write fd const_f_setfl (fromIntegral flags') return () #else