From 0ea9ecafdda5a0743d7879f9e620fba645d4952f Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 26 Sep 2001 10:35:41 +0000 Subject: [PATCH] [project @ 2001-09-26 10:35:41 by simonmar] A failure while trying to set O_NONBLOCK on a file descriptor should be a non-fatal error. It turns out that on FreeBSD it is an error (ENODEV) to try to set O_NONBLOCK on /dev/null. MERGE TO STABLE --- ghc/lib/std/PrelPosix.hsc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ghc/lib/std/PrelPosix.hsc b/ghc/lib/std/PrelPosix.hsc index a2dfdd6..c6b09f5 100644 --- a/ghc/lib/std/PrelPosix.hsc +++ b/ghc/lib/std/PrelPosix.hsc @@ -1,7 +1,7 @@ {-# OPTIONS -fno-implicit-prelude #-} -- --------------------------------------------------------------------------- --- $Id: PrelPosix.hsc,v 1.13 2001/08/23 10:36:50 sewardj Exp $ +-- $Id: PrelPosix.hsc,v 1.14 2001/09/26 10:35:41 simonmar Exp $ -- -- POSIX support layer for the standard libraries -- @@ -212,9 +212,11 @@ getEcho fd = return False setNonBlockingFD fd = do flags <- throwErrnoIfMinus1Retry "setNonBlockingFD" (fcntl_read (fromIntegral fd) (#const F_GETFL)) - throwErrnoIfMinus1Retry "setNonBlockingFD" - (fcntl_write (fromIntegral fd) - (#const F_SETFL) (flags .|. #const O_NONBLOCK)) + -- 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. + fcntl_write (fromIntegral fd) + (#const F_SETFL) (flags .|. #const O_NONBLOCK) #else -- bogus defns for win32 -- 1.7.10.4