Skip to content

Commit 7ff90c9

Browse files
daveinglisjakepetroules
authored andcommitted
Fix buffer slice in _copyFile when the file write only write part of what was asked
issue: #355
1 parent 58a4ca2 commit 7ff90c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SWBUtil/PbxCp.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ func _copyFile(_ srcPath: Path, _ dstPath: Path) throws {
315315
}
316316
var bwritten: Int = 0
317317
repeat {
318-
let rebased = UnsafeRawBufferPointer(rebasing: tmpBuffer[bwritten ..< (bread - bwritten)])
318+
let rebased = UnsafeRawBufferPointer(rebasing: tmpBuffer[bwritten..<bread])
319319
bwritten += try dstFd.write(rebased)
320320
} while (bread > bwritten)
321321
}
@@ -440,7 +440,7 @@ fileprivate func copyTree(_ srcPath: Path, _ dstPath: Path, options: CopyOptions
440440
}
441441
do {
442442
_dstPath = try localFS.realpath(dstPath)
443-
} catch let error as POSIXError {
443+
} catch let error as POSIXError {
444444
outStream <<< "error: \(dstPath.str): \(String(cString: strerror(error.code)))\n"
445445
return false
446446
} catch {

0 commit comments

Comments
 (0)