From 690a5115679a669240c3132396985db4e7cc5c9a Mon Sep 17 00:00:00 2001 From: stolz Date: Mon, 27 Oct 2003 12:09:44 +0000 Subject: [PATCH] [project @ 2003-10-27 12:09:44 by stolz] Avoid setting O_NONBLOCK when already set. --- System/Posix/Internals.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 1.7.10.4