LIB: fix readFile, rm obsolete comment

This commit is contained in:
Julian Ospald 2016-04-16 19:24:36 +02:00
parent 0fca64594d
commit bd707fc193
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
1 changed files with 6 additions and 4 deletions

View File

@ -59,6 +59,10 @@ import System.IO.Error
, isDoesNotExistErrorType
)
import qualified System.Posix.Directory.ByteString as PFD
import System.Posix.FilePath
(
(</>)
)
import System.Posix.Directory.Traversals (realpath)
import qualified System.Posix.Files.ByteString as PF
import System.Posix.Types
@ -304,13 +308,11 @@ readFile ff p =
constructFile fs fv p'
| PF.isSymbolicLink fs = do
-- symlink madness, we need to make sure we save the correct
-- AnchoredFile
-- File
x <- PF.readSymbolicLink (P.fromAbs p')
resolvedSyml <- handleDT p' $ do
-- watch out, we call </> from 'filepath' here, but it is safe
-- TODO: could it happen that too many '..' lead
-- to something like '/' after normalization?
let sfp = (P.fromAbs . P.dirname $ p') `P.combine` x
let sfp = (P.fromAbs . P.dirname $ p') </> x
rsfp <- realpath sfp
readFile ff =<< P.parseAbs rsfp
return $ SymLink p' fv resolvedSyml x