[PATCH] D53000: [Support] Ignore SIGPIPE, don't error on EPIPE from raw_fd_ostream

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 15:12:37 PDT 2018


nickdesaulniers updated this revision to Diff 168714.
nickdesaulniers added a comment.

- use exit code 71 from SIGPIPE signal handler instead


Repository:
  rL LLVM

https://reviews.llvm.org/D53000

Files:
  lib/Support/Unix/Signals.inc
  lib/Support/raw_ostream.cpp


Index: lib/Support/raw_ostream.cpp
===================================================================
--- lib/Support/raw_ostream.cpp
+++ lib/Support/raw_ostream.cpp
@@ -709,6 +709,9 @@
           )
         continue;
 
+      if (errno == EPIPE)
+        break;
+
       // Otherwise it's a non-recoverable error. Note it and quit.
       error_detected(std::error_code(errno, std::generic_category()));
       break;
Index: lib/Support/Unix/Signals.inc
===================================================================
--- lib/Support/Unix/Signals.inc
+++ lib/Support/Unix/Signals.inc
@@ -334,6 +334,10 @@
       if (auto OldInterruptFunction = InterruptFunction.exchange(nullptr))
         return OldInterruptFunction();
 
+      // Send a special return code that drivers can check for.
+      if (Sig == SIGPIPE)
+        exit(71);
+
       raise(Sig);   // Execute the default handler.
       return;
    }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53000.168714.patch
Type: text/x-patch
Size: 916 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181008/517acee3/attachment.bin>


More information about the llvm-commits mailing list