diff options
author | Niklas Hambüchen <mail@nh2.me> | 2017-02-08 03:09:00 +0100 |
---|---|---|
committer | Niklas Hambüchen <mail@nh2.me> | 2017-02-08 03:09:00 +0100 |
commit | fae5cdc103edafb55ef86699dd9571f35b8cf8ed (patch) | |
tree | a775a4b5ec464c686ab50880d6c03f35cf62fcbe /System | |
parent | d0b0e8cf5a7fa5b9dc500d2f623258200818cb16 (diff) |
Fix error message of `createSymbolicLink`.
Consider `ln` (or any other Unix tool):
$ ln -s file1 file2
$ ls -l file2
lrwxrwxrwx 1 niklas niklas 5 Feb 8 03:09 file2 -> file1
$ ln -s file1 file2
ln: failed to create symbolic link 'file2': File exists
The file name mentioned in the error ("link2") is the one
that *could not be created*, not the content of the pointer.
`createSymbolicLink` got this wrong so far, it would print
file1: createSymbolicLink: already exists (File exists)
which is wrong, this file doesn't already exist.
This commit fixes it.
Diffstat (limited to 'System')
-rw-r--r-- | System/Posix/Files.hsc | 2 | ||||
-rw-r--r-- | System/Posix/Files/ByteString.hsc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index bbda084..749f5da 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -253,7 +253,7 @@ createSymbolicLink :: FilePath -> FilePath -> IO () createSymbolicLink file1 file2 = withFilePath file1 $ \s1 -> withFilePath file2 $ \s2 -> - throwErrnoPathIfMinus1_ "createSymbolicLink" file1 (c_symlink s1 s2) + throwErrnoPathIfMinus1_ "createSymbolicLink" file2 (c_symlink s1 s2) foreign import ccall unsafe "symlink" c_symlink :: CString -> CString -> IO CInt diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc index 872817e..23a44e3 100644 --- a/System/Posix/Files/ByteString.hsc +++ b/System/Posix/Files/ByteString.hsc @@ -259,7 +259,7 @@ createSymbolicLink :: RawFilePath -> RawFilePath -> IO () createSymbolicLink file1 file2 = withFilePath file1 $ \s1 -> withFilePath file2 $ \s2 -> - throwErrnoPathIfMinus1_ "createSymbolicLink" file1 (c_symlink s1 s2) + throwErrnoPathIfMinus1_ "createSymbolicLink" file2 (c_symlink s1 s2) foreign import ccall unsafe "symlink" c_symlink :: CString -> CString -> IO CInt |