From: stolz Date: Mon, 27 Oct 2003 12:09:44 +0000 (+0000) Subject: [project @ 2003-10-27 12:09:44 by stolz] X-Git-Tag: nhc98-1-18-release~459 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=690a5115679a669240c3132396985db4e7cc5c9a;p=ghc-base.git [project @ 2003-10-27 12:09:44 by stolz] Avoid setting O_NONBLOCK when already set. --- diff --git a/System/Posix/Internals.hs b/System/Posix/Internals.hs index 7e9e96f..5a1df90 100644 --- a/System/Posix/Internals.hs +++ b/System/Posix/Internals.hs @@ -304,7 +304,9 @@ setNonBlockingFD fd = 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 (fromIntegral fd) const_f_setfl (flags .|. o_NONBLOCK) + unless (testBit flags (fromIntegral o_NONBLOCK)) $ do + c_fcntl_write (fromIntegral fd) const_f_setfl (flags .|. o_NONBLOCK) + return () #else -- bogus defns for win32