about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2016-08-08 10:50:15 +0100
committerGitHub <noreply@github.com>2016-08-08 10:50:15 +0100
commitdf62e30a8883f3c146700f3666442c7ada42ba3c (patch)
treecf4c691a92d377e770ed181dbdf003d0869a90de
parent171c119b48f67171b9cba1091bc58cb61edddd5b (diff)
parent7ad4fda5499e6df3a7eb2eb0504a4f4944179b6d (diff)
downloadklee-df62e30a8883f3c146700f3666442c7ada42ba3c.tar.gz
Merge pull request #450 from andreamattavelli/fix_to_strerror
Fix to #449 by using sys::StrError(errno) to print error messages.
-rw-r--r--tools/klee/main.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index de04d92e..3e469a6e 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -40,6 +40,7 @@
 #include "llvm/LLVMContext.h"
 #include "llvm/Support/FileSystem.h"
 #endif
+#include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Bitcode/ReaderWriter.h"
 #include "llvm/Support/CommandLine.h"
@@ -1430,10 +1431,8 @@ int main(int argc, char **argv, char **envp) {
     if (RunInDir != "") {
       int res = chdir(RunInDir.c_str());
       if (res < 0) {
-        char info[128];
-        char *str = strerror_r(errno, info, sizeof(info));
         klee_error("Unable to change directory to: %s - %s", RunInDir.c_str(),
-                   str);
+                   sys::StrError(errno).c_str());
       }
     }
 
@@ -1495,10 +1494,8 @@ int main(int argc, char **argv, char **envp) {
     if (RunInDir != "") {
       int res = chdir(RunInDir.c_str());
       if (res < 0) {
-        char info[128];
-        char *str = strerror_r(errno, info, sizeof(info));
         klee_error("Unable to change directory to: %s - %s", RunInDir.c_str(),
-                   str);
+                   sys::StrError(errno).c_str());
       }
     }
     interpreter->runFunctionAsMain(mainFn, pArgc, pArgv, pEnvp);