Fixed permission setting in copyFile
[haskell-directory.git] / System / Directory.hs
index e7affb6..c3698a2 100644 (file)
@@ -553,7 +553,7 @@ copyFile fromFPath toFPath =
                  bracketOnError openTmp cleanTmp $ \(tmpFPath, hTmp) ->
                  do allocaBytes bufferSize $ copyContents hFrom hTmp
                     hClose hTmp
-                    try (copyPermissions fromFPath toFPath)
+                    try (copyPermissions fromFPath tmpFPath)
                     renameFile tmpFPath toFPath
           openTmp = openBinaryTempFile (takeDirectory toFPath) ".copyFile.tmp"
           cleanTmp (tmpFPath, hTmp) = do try $ hClose hTmp