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