projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4fc797a
)
[project @ 2004-03-11 10:00:23 by simonmar]
author
simonmar
<unknown>
Thu, 11 Mar 2004 10:00:23 +0000
(10:00 +0000)
committer
simonmar
<unknown>
Thu, 11 Mar 2004 10:00:23 +0000
(10:00 +0000)
Don't call hGetArray with a size of zero (fixes read021).
ghc/compiler/utils/StringBuffer.lhs
patch
|
blob
|
history
diff --git
a/ghc/compiler/utils/StringBuffer.lhs
b/ghc/compiler/utils/StringBuffer.lhs
index
7c61b5b
..
6c5d653
100644
(file)
--- a/
ghc/compiler/utils/StringBuffer.lhs
+++ b/
ghc/compiler/utils/StringBuffer.lhs
@@
-98,7
+98,7
@@
hGetStringBuffer fname = do
r <- hGetBufBA h arr size_i
#else
arr <- newArray_ (0,size_i-1)
- r <- hGetArray h arr size_i
+ r <- if size_i == 0 then return 0 else hGetArray h arr size_i
#endif
if (r /= size_i)
then ioError (userError "short read of file")