Bug 1553039 - default MOZ_GCTIMER output dir to MOZ_UPLOAD_DIR r=jonco
☠☠ backed out by 669e1d3cec9b ☠ ☠
authorSteve Fink <sfink@mozilla.com>
Tue, 21 May 2019 16:53:05 +0000
changeset 474778 da42fc59d4fb71fd6680b5caf0831e752ca03490
parent 474777 96aeb5e59c6685733e6086ade9710abff1d26212
child 474779 f5ae6a49e7911e869c0d003ad725e5c34a765f33
push id36046
push useraiakab@mozilla.com
push dateTue, 21 May 2019 21:45:52 +0000
treeherdermozilla-central@257f2c96cef5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1553039
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1553039 - default MOZ_GCTIMER output dir to MOZ_UPLOAD_DIR r=jonco Differential Revision: https://phabricator.services.mozilla.com/D31962
js/src/gc/Statistics.cpp
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -99,18 +99,28 @@ static FILE* MaybeOpenFileFromEnv(const 
 
   if (strcmp(value, "none") == 0) {
     file = nullptr;
   } else if (strcmp(value, "stdout") == 0) {
     file = stdout;
   } else if (strcmp(value, "stderr") == 0) {
     file = stderr;
   } else {
+    char path[PATH_MAX+1];
+    if (value[0] != '/') {
+      const char* dir = getenv("MOZ_UPLOAD_DIR");
+      if (dir) {
+        SprintfLiteral(path, "%s/%s", dir, value);
+        value = path;
+      }
+    }
+
     file = fopen(value, "a");
     if (!file) {
+      perror("opening log file");
       MOZ_CRASH("Failed to open log file.");
     }
   }
 
   return file;
 }
 
 struct PhaseKindInfo {