[PATCH] D68774: [libFuzzer] Don't prefix absolute paths in fuchsia.

Jake Ehrlich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 16:42:23 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcde860a1c996: [libFuzzer] Don't prefix absolute paths in fuchsia. (authored by jakehehrlich).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68774/new/

https://reviews.llvm.org/D68774

Files:
  compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp


Index: compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
===================================================================
--- compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
+++ compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp
@@ -407,13 +407,14 @@
   // that lacks a mutable working directory. Fortunately, when this is the case
   // a mutable output directory must be specified using "-artifact_prefix=...",
   // so write the log file(s) there.
+  // However, we don't want to apply this logic for absolute paths.
   int FdOut = STDOUT_FILENO;
   if (Cmd.hasOutputFile()) {
-    std::string Path;
-    if (Cmd.hasFlag("artifact_prefix"))
-      Path = Cmd.getFlagValue("artifact_prefix") + "/" + Cmd.getOutputFile();
-    else
-      Path = Cmd.getOutputFile();
+    std::string Path = Cmd.getOutputFile();
+    bool IsAbsolutePath = Path.length() > 1 && Path[0] == '/';
+    if (!IsAbsolutePath && Cmd.hasFlag("artifact_prefix"))
+      Path = Cmd.getFlagValue("artifact_prefix") + "/" + Path;
+
     FdOut = open(Path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0);
     if (FdOut == -1) {
       Printf("libFuzzer: failed to open %s: %s\n", Path.c_str(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68774.224708.patch
Type: text/x-patch
Size: 1148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191011/7e2b0177/attachment.bin>


More information about the llvm-commits mailing list