aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-04-17 17:14:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-06-22 18:22:20 +0000
commit1ac55f4cb0001fed92329746c730aa9a947c09a5 (patch)
tree78b2d7f739b7a4b29aa297366416bf701b6ebde8 /contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
parentbdd1243df58e60e85101c09001d9812a789b6bc4 (diff)
parent8a37c71e9d8855c91b9ef296ed389248f960bb52 (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
index 92b15f14c62f..7b9b8b2f53fb 100644
--- a/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
+++ b/contrib/llvm-project/llvm/lib/Support/raw_ostream.cpp
@@ -56,6 +56,7 @@
#ifdef _WIN32
#include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/Signals.h"
#include "llvm/Support/Windows/WindowsSupport.h"
#endif
@@ -775,6 +776,15 @@ void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
)
continue;
+#ifdef _WIN32
+ // Windows equivalents of SIGPIPE/EPIPE.
+ DWORD WinLastError = GetLastError();
+ if (WinLastError == ERROR_BROKEN_PIPE ||
+ (WinLastError == ERROR_NO_DATA && errno == EINVAL)) {
+ llvm::sys::CallOneShotPipeSignalHandler();
+ errno = EPIPE;
+ }
+#endif
// Otherwise it's a non-recoverable error. Note it and quit.
error_detected(std::error_code(errno, std::generic_category()));
break;
@@ -802,8 +812,6 @@ uint64_t raw_fd_ostream::seek(uint64_t off) {
flush();
#ifdef _WIN32
pos = ::_lseeki64(FD, off, SEEK_SET);
-#elif defined(HAVE_LSEEK64)
- pos = ::lseek64(FD, off, SEEK_SET);
#else
pos = ::lseek(FD, off, SEEK_SET);
#endif