aboutsummaryrefslogtreecommitdiff
path: root/utils/not/not.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2014-11-24 09:08:18 +0000
committerDimitry Andric <dim@FreeBSD.org>2014-11-24 09:08:18 +0000
commit5ca98fd98791947eba83a1ed3f2c8191ef7afa6c (patch)
treef5944309621cee4fe0976be6f9ac619b7ebfc4c2 /utils/not/not.cpp
parent68bcb7db193e4bc81430063148253d30a791023e (diff)
Diffstat (limited to 'utils/not/not.cpp')
-rw-r--r--utils/not/not.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/not/not.cpp b/utils/not/not.cpp
index ebd16189c9bd..a5c7183bd2c9 100644
--- a/utils/not/not.cpp
+++ b/utils/not/not.cpp
@@ -30,7 +30,16 @@ int main(int argc, const char **argv) {
std::string Program = sys::FindProgramByName(argv[0]);
std::string ErrMsg;
- int Result = sys::ExecuteAndWait(Program, argv, 0, 0, 0, 0, &ErrMsg);
+ int Result = sys::ExecuteAndWait(Program, argv, nullptr, nullptr, 0, 0,
+ &ErrMsg);
+#ifdef _WIN32
+ // Handle abort() in msvcrt -- It has exit code as 3. abort(), aka
+ // unreachable, should be recognized as a crash. However, some binaries use
+ // exit code 3 on non-crash failure paths, so only do this if we expect a
+ // crash.
+ if (ExpectCrash && Result == 3)
+ Result = -3;
+#endif
if (Result < 0) {
errs() << "Error: " << ErrMsg << "\n";
if (ExpectCrash)