[llvm-commits] [llvm] r117701 - /llvm/trunk/utils/not/not.cpp

Dan Gohman gohman at apple.com
Fri Oct 29 13:20:29 PDT 2010


Author: djg
Date: Fri Oct 29 15:20:29 2010
New Revision: 117701

URL: http://llvm.org/viewvc/llvm-project?rev=117701&view=rev
Log:
not is testing for a normal exit with a non-zero value. It shouldn't
return success if the child process is killed with a signal.

Modified:
    llvm/trunk/utils/not/not.cpp

Modified: llvm/trunk/utils/not/not.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/not/not.cpp?rev=117701&r1=117700&r2=117701&view=diff
==============================================================================
--- llvm/trunk/utils/not/not.cpp (original)
+++ llvm/trunk/utils/not/not.cpp Fri Oct 29 15:20:29 2010
@@ -9,9 +9,19 @@
 
 #include "llvm/System/Path.h"
 #include "llvm/System/Program.h"
+#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 int main(int argc, const char **argv) {
   sys::Path Program = sys::Program::FindProgramByName(argv[1]);
-  return !sys::Program::ExecuteAndWait(Program, argv + 1);
+
+  std::string ErrMsg;
+  int Result = sys::Program::ExecuteAndWait(Program, argv + 1, 0, 0, 0, 0,
+                                            &ErrMsg);
+  if (Result < 0) {
+    errs() << "Error: " << ErrMsg << "\n";
+    return 1;
+  }
+
+  return Result == 0;
 }





More information about the llvm-commits mailing list