[llvm-commits] [llvm] r103085 - /llvm/trunk/lib/Support/raw_ostream.cpp
Benjamin Kramer
benny.kra at googlemail.com
Wed May 5 08:17:47 PDT 2010
Author: d0k
Date: Wed May 5 10:17:47 2010
New Revision: 103085
URL: http://llvm.org/viewvc/llvm-project?rev=103085&view=rev
Log:
Try again if write(2) reports an recoverable error.
This should fix mysteriously crashing boost regression tests when stderr is
managed by bjam (PR7043).
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=103085&r1=103084&r2=103085&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Wed May 5 10:17:47 2010
@@ -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 @@
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();
}
More information about the llvm-commits
mailing list