[project @ 2002-11-20 13:44:41 by simonmar]
authorsimonmar <unknown>
Wed, 20 Nov 2002 13:44:41 +0000 (13:44 +0000)
committersimonmar <unknown>
Wed, 20 Nov 2002 13:44:41 +0000 (13:44 +0000)
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

index 819f2f4..82fb011 100644 (file)
@@ -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"