From 68469a84f056b9109f291e33760939da3a30cc99 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 20 Nov 2002 13:44:41 +0000 Subject: [PATCH] [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 --- GHC/Posix.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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" -- 1.7.10.4