summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-15 16:43:01 +0000
committerDan Gohman <gohman@apple.com>2009-07-15 16:43:01 +0000
commit213e87b1fe15b35fc8d1885ecedfa1b83c5cb153 (patch)
tree263989f06739456b896fc26b48f4bbc63bfecab2 /llvm/lib/Support/raw_ostream.cpp
parent33fb640835a11d258b3f43a9ba7843de78c69238 (diff)
downloadbcm5719-llvm-213e87b1fe15b35fc8d1885ecedfa1b83c5cb153.tar.gz
bcm5719-llvm-213e87b1fe15b35fc8d1885ecedfa1b83c5cb153.zip
Check for errors on close(2) too. And lseek(2).
llvm-svn: 75793
Diffstat (limited to 'llvm/lib/Support/raw_ostream.cpp')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 3e1a8a9765c..0595fe47e12 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -279,7 +279,8 @@ raw_fd_ostream::~raw_fd_ostream() {
if (FD >= 0) {
flush();
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);
ShouldClose = false;
flush();
- ::close(FD);
+ if (::close(FD) != 0)
+ llvm_report_error("IO failure closing output stream.");
FD = -1;
}
uint64_t raw_fd_ostream::seek(uint64_t off) {
flush();
pos = ::lseek(FD, off, SEEK_SET);
+ if (pos != off)
+ llvm_report_error("IO failure seeking on output stream.");
return pos;
}
OpenPOWER on IntegriCloud