diff options
author | stolz <unknown> | 2002-11-18 08:37:35 +0000 |
---|---|---|
committer | stolz <unknown> | 2002-11-18 08:37:35 +0000 |
commit | 67022b18faf8b611297d067a6d5666845bbf4496 (patch) | |
tree | 8e795da1008154ee9d6048030294237c91cac580 /System/Posix/Files.hsc | |
parent | ef14d01e18d7f651142353b064802a57cb69d64f (diff) |
[project @ 2002-11-18 08:37:35 by stolz]
readlink(2) does not append a NUL character to buffer.
Noticed by: John Meacham <john@repetae.net>
Diffstat (limited to 'System/Posix/Files.hsc')
-rw-r--r-- | System/Posix/Files.hsc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index cc9312b..a12b34c 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -352,10 +352,10 @@ foreign import ccall unsafe "symlink" readSymbolicLink :: FilePath -> IO FilePath readSymbolicLink file = allocaArray0 (#const PATH_MAX) $ \buf -> do - withCString file $ \s -> - throwErrnoIfMinus1_ "readSymbolicLink" $ + withCString file $ \s -> do + len <- throwErrnoIfMinus1 "readSymbolicLink" $ c_readlink s buf (#const PATH_MAX) - peekCString buf + peekCStringLen (buf,fromIntegral len) foreign import ccall unsafe "readlink" c_readlink :: CString -> CString -> CInt -> IO CInt |