aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support
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
commit597da3cc116b57018e9bea71be0fae10fdf58b8c (patch)
tree514f5824eeb99ae71b3701b74bcc28fb91675650 /lib/Support
parentcb87a6d95cc3992d6eabe7145882368180871beb (diff)
downloadexternal_llvm-597da3cc116b57018e9bea71be0fae10fdf58b8c.zip
external_llvm-597da3cc116b57018e9bea71be0fae10fdf58b8c.tar.gz
external_llvm-597da3cc116b57018e9bea71be0fae10fdf58b8c.tar.bz2
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
Diffstat (limited to 'lib/Support')
-rw-r--r--lib/Support/raw_ostream.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 3e1a8a9..0595fe4 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/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;
}