summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-05-05 15:17:47 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-05-05 15:17:47 +0000
commitce84a2558c586c57e125785766a1d0918940bf31 (patch)
treee15c825562a39decf7f522afc2ab942ce444fc10 /llvm/lib/Support/raw_ostream.cpp
parente8282890eca2e6d3a13fd4edcf7dbbe1507e99a8 (diff)
downloadbcm5719-llvm-ce84a2558c586c57e125785766a1d0918940bf31.tar.gz
bcm5719-llvm-ce84a2558c586c57e125785766a1d0918940bf31.zip
Try again if write(2) reports an recoverable error.
This should fix mysteriously crashing boost regression tests when stderr is managed by bjam (PR7043). llvm-svn: 103085
Diffstat (limited to 'llvm/lib/Support/raw_ostream.cpp')
-rw-r--r--llvm/lib/Support/raw_ostream.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 0b05c5449ae..f8ac65d7e13 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -21,6 +21,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/STLExtras.h"
#include <cctype>
+#include <cerrno>
#include <sys/stat.h>
#include <sys/types.h>
@@ -420,7 +421,11 @@ raw_fd_ostream::~raw_fd_ostream() {
void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
assert(FD >= 0 && "File already closed.");
pos += Size;
- if (::write(FD, Ptr, Size) != (ssize_t) Size)
+ ssize_t ret;
+ do {
+ ret = ::write(FD, Ptr, Size);
+ } while (ret < 0 && (errno == EAGAIN || errno == EINTR));
+ if (ret != (ssize_t) Size)
error_detected();
}
OpenPOWER on IntegriCloud