Bug 1349531 - Remove non-threadsafe static buffers, r=jandem
authorSteve Fink <sfink@mozilla.com>
Wed, 24 May 2017 19:36:33 -0700
changeset 585323 6994cbd66d9751acd87d5005f9eb67e7eea62af2
parent 585322 66f6f2abe43b203af51fe63003b7d8c0b1bc5420
child 585324 d40d37c7b0c11646fe6f329138eaf61468cf3426
push id61093
push userdgottwald@mozilla.com
push dateFri, 26 May 2017 20:16:26 +0000
reviewersjandem
bugs1349531
milestone55.0a1
Bug 1349531 - Remove non-threadsafe static buffers, r=jandem
js/src/shell/OSObject.cpp
--- a/js/src/shell/OSObject.cpp
+++ b/js/src/shell/OSObject.cpp
@@ -118,17 +118,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;
@@ -227,17 +227,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)