[PATCH] D53000: [Support] exit with custom return code for SIGPIPE
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 8 16:14:30 PDT 2018
nickdesaulniers updated this revision to Diff 168729.
nickdesaulniers added a comment.
- prefer EX_IOERR from sysexits.h
Repository:
rL LLVM
https://reviews.llvm.org/D53000
Files:
lib/Support/Unix/Signals.inc
Index: lib/Support/Unix/Signals.inc
===================================================================
--- lib/Support/Unix/Signals.inc
+++ lib/Support/Unix/Signals.inc
@@ -47,6 +47,7 @@
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <string>
+#include <sysexits.h>
#ifdef HAVE_BACKTRACE
# include BACKTRACE_HEADER // For backtrace().
#endif
@@ -334,6 +335,10 @@
if (auto OldInterruptFunction = InterruptFunction.exchange(nullptr))
return OldInterruptFunction();
+ // Send a special return code that drivers can check for, from sysexits.h.
+ if (Sig == SIGPIPE)
+ exit(EX_IOERR);
+
raise(Sig); // Execute the default handler.
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53000.168729.patch
Type: text/x-patch
Size: 727 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181008/833a9020/attachment.bin>
More information about the llvm-commits
mailing list