Skip to content

Commit 6aa0ee4

Browse files
authored
Fix silent-overwrite behavior of FileManager.copyItem() on Linux
1 parent 9f53cc5 commit 6aa0ee4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: Sources/Foundation/FileManager+POSIX.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ extension FileManager {
584584
}
585585
defer { close(srcfd) }
586586

587-
let dstfd = open(dstRep, O_WRONLY | O_CREAT | O_TRUNC, 0o666)
587+
let dstfd = open(dstRep, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC, 0o666)
588588
guard dstfd >= 0 else {
589589
throw _NSErrorWithErrno(errno, reading: false, path: dstPath,
590590
extraUserInfo: extraErrorInfo(srcPath: srcPath, dstPath: dstPath, userVariant: variant))

0 commit comments

Comments
 (0)