Bug 1287711 - Use PR_SetEnv, a=bustage
authorMartin Thomson <martin.thomson@gmail.com>
Tue, 03 Oct 2017 13:41:28 -0700
changeset 13619 24729e83ed5c74caea7660d8884d0e448d584d5e
parent 13618 488c17f05a1ff5c9867c78af2708062c02c49ad8
child 13620 68da790a91ea7e1a38190b4763796419b33a4d81
push id2399
push usermartin.thomson@gmail.com
push dateTue, 03 Oct 2017 20:42:22 +0000
reviewersbustage
bugs1287711
Bug 1287711 - Use PR_SetEnv, a=bustage
gtests/ssl_gtest/ssl_keylog_unittest.cc
--- a/gtests/ssl_gtest/ssl_keylog_unittest.cc
+++ b/gtests/ssl_gtest/ssl_keylog_unittest.cc
@@ -8,24 +8,26 @@
 #include <fstream>
 #include <sstream>
 
 #include "gtest_utils.h"
 #include "tls_connect.h"
 
 namespace nss_test {
 
-static const char *keylog_file_path = "keylog.txt";
+static const std::string keylog_file_path = "keylog.txt";
 
 class KeyLogFileTest : public TlsConnectGeneric {
  public:
   void SetUp() {
     TlsConnectTestBase::SetUp();
     remove(keylog_file_path);
-    setenv("SSLKEYLOGFILE", keylog_file_path, 1);
+    std::ostringstream sstr;
+    sstr << "SSLKEYLOGFILE=" << keylog_file_path;
+    PR_SetEnv(sstr.c_str());
   }
 
   void CheckKeyLog() {
     std::ifstream f(keylog_file_path);
     std::map<std::string, size_t> labels;
     std::string last_client_random;
     for (std::string line; std::getline(f, line);) {
       if (line[0] == '#') {