]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Convert last usage of putenv
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 24 May 2020 09:25:06 +0000 (11:25 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 24 May 2020 18:49:09 +0000 (20:49 +0200)
src/ccache.cpp

index 846e23b76c9f6523c4a27fcaae8c6df53b0e58fc..eb15808c5f4b5dd8d07c0252d5d136f3386c16e1 100644 (file)
@@ -1899,12 +1899,7 @@ set_up_uncached_err()
     failed(STATS_ERROR);
   }
 
-  // Leak a pointer to the environment.
-  char* buf = format("UNCACHED_ERR_FD=%d", uncached_fd);
-  if (putenv(buf) == -1) {
-    cc_log("putenv failed: %s", strerror(errno));
-    failed(STATS_ERROR);
-  }
+  x_setenv("UNCACHED_ERR_FD", fmt::format("{}", uncached_fd).c_str());
 }
 
 static void