aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2014-10-09 21:38:11 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2014-10-09 21:38:19 -0700
commit2f639ffe09dd24d8648363b567de2d7caa39db99 (patch)
treee9d20f284903563cbdfed76c76ca976d0474b69d /src/Haddock.hs
parenta65d2131647e010608d2a1956116a0012946838f (diff)
Fix use-after-close lazy IO bug
Make `getPrologue` force `parseParas dflags str` before returning. Without this, it will attempt to read from the file after it is closed, with unspecified and generally bad results. Signed-off-by: David Feuer <David.Feuer@gmail.com> Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'src/Haddock.hs')
-rw-r--r--src/Haddock.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Haddock.hs b/src/Haddock.hs
index 980926cd..c0a6714b 100644
--- a/src/Haddock.hs
+++ b/src/Haddock.hs
@@ -451,7 +451,7 @@ getPrologue dflags flags =
[filename] -> withFile filename ReadMode $ \h -> do
hSetEncoding h utf8
str <- hGetContents h
- return . Just $ parseParas dflags str
+ return . Just $! parseParas dflags str
_ -> throwE "multiple -p/--prologue options"