mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-02 02:55:35 +00:00
Revert "Support/Path: remove raw delete"
This reverts commit r216360. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216428 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
759a71a1fa
commit
27dc1b8446
@ -881,8 +881,7 @@ std::error_code copy_file(const Twine &From, const Twine &To) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const size_t BufSize = 4096;
|
const size_t BufSize = 4096;
|
||||||
std::vector<char> Buffer(BufSize);
|
char *Buf = new char[BufSize];
|
||||||
char *Buf = Buffer.data();
|
|
||||||
int BytesRead = 0, BytesWritten = 0;
|
int BytesRead = 0, BytesWritten = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
BytesRead = read(ReadFD, Buf, BufSize);
|
BytesRead = read(ReadFD, Buf, BufSize);
|
||||||
@ -899,6 +898,7 @@ std::error_code copy_file(const Twine &From, const Twine &To) {
|
|||||||
}
|
}
|
||||||
close(ReadFD);
|
close(ReadFD);
|
||||||
close(WriteFD);
|
close(WriteFD);
|
||||||
|
delete[] Buf;
|
||||||
|
|
||||||
if (BytesRead < 0 || BytesWritten < 0)
|
if (BytesRead < 0 || BytesWritten < 0)
|
||||||
return std::error_code(errno, std::generic_category());
|
return std::error_code(errno, std::generic_category());
|
||||||
|
Loading…
Reference in New Issue
Block a user