about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel@schemmel.net>2023-02-16 16:43:47 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-02-17 10:48:11 +0000
commit03a38141f95f132ebb8bd840e3063b504fe3ed1d (patch)
treef8155922b9cdcac6bdc670bf70700764266f7580 /tools
parent7e0e773b5c2fa00ab09f0756d4dadadc5b6f37eb (diff)
downloadklee-03a38141f95f132ebb8bd840e3063b504fe3ed1d.tar.gz
create klee-last as a relative link
Diffstat (limited to 'tools')
-rw-r--r--tools/klee/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
index 5e8ce864..59261e49 100644
--- a/tools/klee/main.cpp
+++ b/tools/klee/main.cpp
@@ -381,9 +381,15 @@ KleeHandler::KleeHandler(int argc, char **argv)
         SmallString<128> klee_last(directory);
         llvm::sys::path::append(klee_last, "klee-last");
 
-        if (((unlink(klee_last.c_str()) < 0) && (errno != ENOENT)) ||
-            symlink(m_outputDirectory.c_str(), klee_last.c_str()) < 0) {
+        if ((unlink(klee_last.c_str()) < 0) && (errno != ENOENT)) {
+          klee_warning("cannot remove existing klee-last symlink: %s",
+                       strerror(errno));
+        }
 
+        size_t offset = m_outputDirectory.size() -
+                        llvm::sys::path::filename(m_outputDirectory).size();
+        if (symlink(m_outputDirectory.c_str() + offset, klee_last.c_str()) <
+            0) {
           klee_warning("cannot create klee-last symlink: %s", strerror(errno));
         }