Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ enum _FileOperations {
defer { close(dstFD) }

#if canImport(Darwin)
if fcopyfile(srcFD, dstFD, nil, copyfile_flags_t(COPYFILE_METADATA | COPYFILE_NOFOLLOW | extraFlags)) != 0 {
if fcopyfile(srcFD, dstFD, nil, copyfile_flags_t(COPYFILE_METADATA | COPYFILE_NOFOLLOW | extraFlags)) < 0 {
Copy link
Contributor

@glessard glessard Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation is that fcopyfile returns "less than 0 on error, and 0 on success", so the test already matched the documentation. If we're going to be this nit-picky, we should also assert that the return value is not greater than zero.

try delegate.throwIfNecessary(errno, String(cString: src), String(cString: dst))
}
#else
Expand Down