summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorqrczak <unknown>2001-01-12 17:45:30 +0000
committerqrczak <unknown>2001-01-12 17:45:30 +0000
commit99d658e8ddba3b2f888a876ca9b06d4062cb6bd9 (patch)
treebda0630104f4066d38dc84003d500c833fd31c99 /ghc
parentaf58ba6db3cfc450c4474af154d3d2e7a3167fdd (diff)
downloadhaskell-99d658e8ddba3b2f888a876ca9b06d4062cb6bd9.tar.gz
[project @ 2001-01-12 17:45:30 by qrczak]
Add resetErrno :: IO () Use it in Directory, before calling readdir.
Diffstat (limited to 'ghc')
-rw-r--r--ghc/lib/std/Directory.hsc3
-rw-r--r--ghc/lib/std/PrelCError.lhs9
2 files changed, 10 insertions, 2 deletions
diff --git a/ghc/lib/std/Directory.hsc b/ghc/lib/std/Directory.hsc
index 67f959f784..2672fea907 100644
--- a/ghc/lib/std/Directory.hsc
+++ b/ghc/lib/std/Directory.hsc
@@ -1,5 +1,5 @@
-- -----------------------------------------------------------------------------
--- $Id: Directory.hsc,v 1.2 2001/01/12 15:48:56 simonmar Exp $
+-- $Id: Directory.hsc,v 1.3 2001/01/12 17:45:30 qrczak Exp $
--
-- (c) The University of Glasgow, 1994-2000
--
@@ -345,6 +345,7 @@ getDirectoryContents path = do
where
loop :: Ptr CDir -> IO [String]
loop dir = do
+ resetErrno
p <- readdir dir
if (p /= nullPtr)
then do entry <- peekCString ((#ptr struct dirent,d_name) p)
diff --git a/ghc/lib/std/PrelCError.lhs b/ghc/lib/std/PrelCError.lhs
index 84553214aa..757f43bea9 100644
--- a/ghc/lib/std/PrelCError.lhs
+++ b/ghc/lib/std/PrelCError.lhs
@@ -1,5 +1,5 @@
% -----------------------------------------------------------------------------
-% $Id: PrelCError.lhs,v 1.1 2001/01/11 17:25:57 simonmar Exp $
+% $Id: PrelCError.lhs,v 1.2 2001/01/12 17:45:30 qrczak Exp $
%
% (c) The FFI task force, 2000
%
@@ -39,6 +39,7 @@ module PrelCError (
-- access to the current thread's "errno" value
--
getErrno, -- :: IO Errno
+ resetErrno, -- :: IO ()
-- conversion of an "errno" value into IO error
--
@@ -281,6 +282,12 @@ getErrno :: IO Errno
getErrno = liftM Errno (peek _errno)
+-- set the current thread's "errno" value to 0
+--
+resetErrno :: IO ()
+resetErrno = poke _errno 0
+
+
-- throw current "errno" value
-- ---------------------------