From: simonmar Date: Wed, 20 Nov 2002 13:44:41 +0000 (+0000) Subject: [project @ 2002-11-20 13:44:41 by simonmar] X-Git-Tag: nhc98-1-18-release~796 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=68469a84f056b9109f291e33760939da3a30cc99;p=haskell-directory.git [project @ 2002-11-20 13:44:41 by simonmar] Allow opening a character special device; we treat it as a stream, even though it might be seekable. This allows opening /dev/stdin, /dev/null, etc. MERGE TO STABLE --- diff --git a/GHC/Posix.hs b/GHC/Posix.hs index 819f2f4..82fb011 100644 --- a/GHC/Posix.hs +++ b/GHC/Posix.hs @@ -92,10 +92,11 @@ fdType fd = statGetType p_stat = do c_mode <- st_mode p_stat :: IO CMode case () of - _ | s_isdir c_mode -> return Directory - | s_isfifo c_mode || s_issock c_mode -> return Stream - | s_isreg c_mode -> return RegularFile - | otherwise -> ioException ioe_unknownfiletype + _ | s_isdir c_mode -> return Directory + | s_isfifo c_mode || s_issock c_mode || s_ischr c_mode + -> return Stream + | s_isreg c_mode -> return RegularFile + | otherwise -> ioException ioe_unknownfiletype ioe_unknownfiletype = IOError Nothing UnsupportedOperation "fdType"