mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-21 18:29:45 +00:00
Check for errors on close(2) too. And lseek(2).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75793 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9f79d3ea50
commit
d3a974fc20
@ -279,7 +279,8 @@ raw_fd_ostream::~raw_fd_ostream() {
|
|||||||
if (FD >= 0) {
|
if (FD >= 0) {
|
||||||
flush();
|
flush();
|
||||||
if (ShouldClose)
|
if (ShouldClose)
|
||||||
::close(FD);
|
if (::close(FD) != 0)
|
||||||
|
llvm_report_error("IO failure closing output stream.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,13 +295,16 @@ void raw_fd_ostream::close() {
|
|||||||
assert (ShouldClose);
|
assert (ShouldClose);
|
||||||
ShouldClose = false;
|
ShouldClose = false;
|
||||||
flush();
|
flush();
|
||||||
::close(FD);
|
if (::close(FD) != 0)
|
||||||
|
llvm_report_error("IO failure closing output stream.");
|
||||||
FD = -1;
|
FD = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t raw_fd_ostream::seek(uint64_t off) {
|
uint64_t raw_fd_ostream::seek(uint64_t off) {
|
||||||
flush();
|
flush();
|
||||||
pos = ::lseek(FD, off, SEEK_SET);
|
pos = ::lseek(FD, off, SEEK_SET);
|
||||||
|
if (pos != off)
|
||||||
|
llvm_report_error("IO failure seeking on output stream.");
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user