diff -r 5590a265b1f6 Network/Socket.hsc
--- a/Network/Socket.hsc	Thu Nov 11 15:05:18 2010 +0100
+++ b/Network/Socket.hsc	Fri Nov 26 15:08:38 2010 -0800
@@ -1,4 +1,4 @@
-{-# OPTIONS -fglasgow-exts -cpp #-}
+{-# LANGUAGE CPP #-}
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  Network.Socket
@@ -200,6 +200,9 @@
 
 #ifdef __GLASGOW_HASKELL__
 import GHC.Conc		(threadWaitRead, threadWaitWrite)
+##if MIN_VERSION_base(4,3,1)
+import GHC.Conc		(closeFd)
+##endif
 # if defined(mingw32_HOST_OS)
 import GHC.Conc		( asyncDoProc )
 import Foreign( FunPtr )
@@ -1039,6 +1042,10 @@
      return (pid, uid, gid)
 #endif
 
+##if !MIN_VERSION_base(4,3,1)
+closeFd closer fd = closer fd
+##endif
+
 #if defined(DOMAIN_SOCKET_SUPPORT)
 -- sending/receiving ancillary socket data; low-level mechanism
 -- for transmitting file descriptors, mainly.
@@ -1054,8 +1061,7 @@
 #endif
    -- Note: If Winsock supported FD-passing, thi would have been 
    -- incorrect (since socket FDs need to be closed via closesocket().)
-  c_close outfd
-  return ()
+  close outfd
   
 recvFd :: Socket -> IO CInt
 recvFd sock = do
@@ -1692,7 +1698,7 @@
 	 ioError (userError ("sClose: converted to a Handle, use hClose instead"))
      Closed ->
 	 return status
-     _ -> c_close s >> return Closed
+     _ -> closeFd (close . fromIntegral) (fromIntegral s) >> return Closed
 
 -- -----------------------------------------------------------------------------
 
@@ -2171,6 +2177,9 @@
 foreign import CALLCONV unsafe "shutdown"
   c_shutdown :: CInt -> CInt -> IO CInt 
 
+close :: CInt -> IO ()
+close fd = c_close fd >> return ()
+
 #if !defined(WITH_WINSOCK)
 foreign import ccall unsafe "close"
   c_close :: CInt -> IO CInt
