Bug 1349531 - Remove non-threadsafe static buffers, r=jandem a=NPOTB
authorSteve Fink <sfink@mozilla.com>
Wed, 24 May 2017 19:36:33 -0700
changeset 396427 a1827dca2447b9db46cf0c72a704ab76268e018a
parent 396426 8856170020cf83c9cc8da98e187125ca6cdab66b
child 396428 befb19ed674f441caf07c85c0fff5f168af8c14a
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem, NPOTB
bugs1349531
milestone54.0
Bug 1349531 - Remove non-threadsafe static buffers, r=jandem a=NPOTB
js/src/shell/OSObject.cpp
--- a/js/src/shell/OSObject.cpp
+++ b/js/src/shell/OSObject.cpp
@@ -121,17 +121,17 @@ ResolvePath(JSContext* cx, HandleString 
 
         if (!scriptFilename.get())
             return nullptr;
 
         if (strcmp(scriptFilename.get(), "-e") == 0 || strcmp(scriptFilename.get(), "typein") == 0)
             resolveMode = RootRelative;
     }
 
-    static char buffer[PATH_MAX+1];
+    char buffer[PATH_MAX+1];
     if (resolveMode == ScriptRelative) {
 #ifdef XP_WIN
         // The docs say it can return EINVAL, but the compiler says it's void
         _splitpath(scriptFilename.get(), nullptr, buffer, nullptr, nullptr);
 #else
         strncpy(buffer, scriptFilename.get(), PATH_MAX+1);
         if (buffer[PATH_MAX] != '\0')
             return nullptr;
@@ -230,17 +230,17 @@ FileAsTypedArray(JSContext* cx, JS::Hand
 }
 
 /**
  * Return the current working directory or |null| on failure.
  */
 UniqueChars
 GetCWD()
 {
-    static char buffer[PATH_MAX + 1];
+    char buffer[PATH_MAX + 1];
     const char* cwd = getcwd(buffer, PATH_MAX);
     if (!cwd)
         return UniqueChars();
     return js::DuplicateString(buffer);
 }
 
 static bool
 ReadFile(JSContext* cx, unsigned argc, Value* vp, bool scriptRelative)