diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-05-05 15:17:47 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-05-05 15:17:47 +0000 |
commit | 66760be9195d0f19efc462c080e6d123e862d641 (patch) | |
tree | 7ca3458997a8ffa666bc2ded58ff104475292fbb /lib | |
parent | d1dd5ed0ed9b4456c354fdd7b13eb14d6db7efa7 (diff) | |
download | external_llvm-66760be9195d0f19efc462c080e6d123e862d641.zip external_llvm-66760be9195d0f19efc462c080e6d123e862d641.tar.gz external_llvm-66760be9195d0f19efc462c080e6d123e862d641.tar.bz2 |
Try again if write(2) reports an recoverable error.
This should fix mysteriously crashing boost regression tests when stderr is
managed by bjam (PR7043).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103085 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Support/raw_ostream.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 0b05c54..f8ac65d 100644 --- a/lib/Support/raw_ostream.cpp +++ b/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(); } |