X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FHandle.hs;h=0e9b3be0a957ede3b356cbc61c4d17495525406e;hb=91adf39c07706a188278aa6983e9b4f1ea4f400f;hp=a3cf25bb450fb7643219e0f9e0f068a694dfd68b;hpb=8a98bd5954b24b591156198d89329041c4c0e426;p=haskell-directory.git diff --git a/GHC/Handle.hs b/GHC/Handle.hs index a3cf25b..0e9b3be 100644 --- a/GHC/Handle.hs +++ b/GHC/Handle.hs @@ -915,10 +915,6 @@ openFd fd mb_fd_type is_socket filepath mode binary = do ioException (IOError Nothing InappropriateType "openFile" "is a directory" Nothing) - Stream - | ReadWriteHandle <- ha_type -> mkDuplexHandle fd is_socket filepath binary - | otherwise -> mkFileHandle fd is_socket filepath ha_type binary - -- regular files need to be locked RegularFile -> do #ifndef mingw32_HOST_OS @@ -928,7 +924,16 @@ openFd fd mb_fd_type is_socket filepath mode binary = do "file is locked" Nothing) #endif mkFileHandle fd is_socket filepath ha_type binary - + -- Stream or RawDevice + Stream -> mkIt ha_type + RawDevice -> mkIt ha_type + _ -> + ioException (IOError Nothing UnsupportedOperation "openFd" + "unknown file type" Nothing) + where + mkIt ht + | isReadWriteHandleType ht = mkDuplexHandle fd is_socket filepath binary + | otherwise = mkFileHandle fd is_socket filepath ht binary fdToHandle :: FD -> IO Handle fdToHandle fd = do @@ -1462,9 +1467,8 @@ hIsSeekable handle = SemiClosedHandle -> ioe_closedHandle AppendHandle -> return False _ -> do t <- fdType (haFD handle_) - return (t == RegularFile - && (haIsBin handle_ - || tEXT_MODE_SEEK_ALLOWED)) + return ((t == RegularFile || t == RawDevice) + && (haIsBin handle_ || tEXT_MODE_SEEK_ALLOWED)) -- ----------------------------------------------------------------------------- -- Changing echo status (Non-standard GHC extensions)