[llvm-commits] [llvm] r75793 - /llvm/trunk/lib/Support/raw_ostream.cpp
Dan Gohman
gohman at apple.com
Wed Jul 15 09:43:01 PDT 2009
Author: djg
Date: Wed Jul 15 11:43:01 2009
New Revision: 75793
URL: http://llvm.org/viewvc/llvm-project?rev=75793&view=rev
Log:
Check for errors on close(2) too. And lseek(2).
Modified:
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=75793&r1=75792&r2=75793&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Wed Jul 15 11:43:01 2009
@@ -279,7 +279,8 @@
if (FD >= 0) {
flush();
if (ShouldClose)
- ::close(FD);
+ if (::close(FD) != 0)
+ llvm_report_error("IO failure closing output stream.");
}
}
@@ -294,13 +295,16 @@
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;
}
More information about the llvm-commits
mailing list