diff --git a/gerrit-httpd/pom.xml b/gerrit-httpd/pom.xml
index 07026c9783..39b2788736 100644
--- a/gerrit-httpd/pom.xml
+++ b/gerrit-httpd/pom.xml
@@ -74,6 +74,12 @@ limitations under the License.
gwtjsonrpc
+
+ com.google.gerrit
+ gerrit-launcher
+ ${project.version}
+
+
com.google.gerrit
gerrit-server
diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java
index 3a1f2b62c6..04f85a7fe7 100644
--- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java
+++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/gitweb/GitWebServlet.java
@@ -31,6 +31,7 @@ package com.google.gerrit.httpd.gitweb;
import com.google.gerrit.common.data.GerritConfig;
import com.google.gerrit.httpd.GitWebConfig;
+import com.google.gerrit.launcher.GerritLauncher;
import com.google.gerrit.reviewdb.Project;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.config.SitePaths;
@@ -117,7 +118,7 @@ class GitWebServlet extends HttpServlet {
private void makeSiteConfig(final SitePaths site,
final GerritConfig gerritConfig) throws IOException {
- final File myconf = File.createTempFile("gitweb_config_", ".perl");
+ final File myconf = GerritLauncher.createTempFile("gitweb_config", ".perl");
// To make our configuration file only readable or writable by us;
// this reduces the chances of someone tampering with the file.
@@ -128,7 +129,6 @@ class GitWebServlet extends HttpServlet {
myconf.setWritable(true, true /* owner only */);
myconf.setReadable(true, true /* owner only */);
- myconf.deleteOnExit();
_env.set("GIT_DIR", ".");
_env.set("GITWEB_CONFIG", myconf.getAbsolutePath());
diff --git a/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java b/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java
index 14b484eaf3..a097d75851 100644
--- a/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java
+++ b/gerrit-launcher/src/main/java/com/google/gerrit/launcher/GerritLauncher.java
@@ -361,7 +361,7 @@ public final class GerritLauncher {
* directory if a directory was preferred.
* @throws IOException the file could not be created.
*/
- public static File createTempFile(String prefix, String suffix)
+ public static synchronized File createTempFile(String prefix, String suffix)
throws IOException {
if (!temporaryDirectoryFound) {
final File d = File.createTempFile("gerrit_", "_app", tmproot());