Commit Diff


commit - fa44fa48d07a2b4a0afb6c3eb203fb4bfbf5bdb1
commit + bb63914a95fa51c7f5dc16d02b8f4ae2736e2e15
blob - 50614083810a5bff0ea9c6caeb85872bb9a8495d
blob + 7efbdf75d485c6eff4a6674c9ec6c3b8de8eee1a
--- README
+++ README
@@ -61,7 +61,7 @@ This will create the following files:
   helper programs from the libexec directory in /var/www/cgi-bin/gotweb/libexec
   several template files in /var/www/cgi-bin/gw_tmpl/
   html, css, and image files in /var/www/htdocs/gotweb/
-  the directory /var/www/tmp/
+  the directory /var/www/got/tmp/
   man pages (only installed if building sources from a Got release tarball)
 
 Documentation is available in manual pages:
blob - 4329f781964bc8101d3f2bf6cb34c09f6836eee1
blob + 4a5d5fcafa19f89e6039addb90f3c1979ea584e3
--- got/got.c
+++ got/got.c
@@ -297,8 +297,8 @@ apply_unveil(const char *repo_path, int repo_read_only
 	if (worktree_path && unveil(worktree_path, "rwc") != 0)
 		return got_error_from_errno2("unveil", worktree_path);
 
-	if (unveil("/tmp", "rwc") != 0)
-		return got_error_from_errno2("unveil", "/tmp");
+	if (unveil(GOT_TMPDIR_STR, "rwc") != 0)
+		return got_error_from_errno2("unveil", GOT_TMPDIR_STR);
 
 	err = got_privsep_unveil_exec_helpers();
 	if (err != NULL)
@@ -482,7 +482,8 @@ collect_import_msg(char **logmsg, char **logmsg_path, 
 	    branch_name) == -1)
 		return got_error_from_errno("asprintf");
 
-	err = got_opentemp_named_fd(logmsg_path, &fd, "/tmp/got-importmsg");
+	err = got_opentemp_named_fd(logmsg_path, &fd,
+	    GOT_TMPDIR_STR "/got-importmsg");
 	if (err)
 		goto done;
 
@@ -3789,7 +3790,7 @@ get_tag_message(char **tagmsg, char **tagmsg_path, con
 	char *editor = NULL;
 	int fd = -1;
 
-	if (asprintf(&template, "/tmp/got-tagmsg") == -1) {
+	if (asprintf(&template, GOT_TMPDIR_STR "/got-tagmsg") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto done;
 	}
@@ -5802,7 +5803,8 @@ histedit_edit_logmsg(struct got_histedit_list_entry *h
 	if (err)
 		goto done;
 
-	err = got_opentemp_named_fd(&logmsg_path, &fd, "/tmp/got-logmsg");
+	err = got_opentemp_named_fd(&logmsg_path, &fd,
+	    GOT_TMPDIR_STR "/got-logmsg");
 	if (err)
 		goto done;
 
blob - 445d0547c1b8dab53c9f2b9614677e67258d33fd
blob + b892a2737fbd3ddb11b85530d34cd64faa601a8b
--- gotweb/Makefile.inc
+++ gotweb/Makefile.inc
@@ -7,10 +7,13 @@ LIBEXECDIR =	${GOTWEB_DIR}/libexec
 LIBEXEC_DIR =	${CHROOT_DIR}${LIBEXECDIR}
 ETC_DIR =	${CHROOT_DIR}/etc
 HTTPD_DIR =	${CHROOT_DIR}/htdocs
-TMP_DIR =	${CHROOT_DIR}/tmp
+GOTWEB_TMP_DIR ?=	/got/tmp
+TMP_DIR =	${CHROOT_DIR}${GOTWEB_TMP_DIR}
 PROG_DIR =	${HTTPD_DIR}/${PROG}
 CGI_DIR =	${CHROOT_DIR}${GOTWEB_DIR}
 TMPL_DIR =	${CGI_DIR}/gw_tmpl
 PUB_REPOS_DIR =	${CHROOT_DIR}/got/public
 WWWUSR ?=	www
 WWWGRP ?=	www
+
+CPPFLAGS +=	-DGOT_TMPDIR=${GOTWEB_TMP_DIR}
blob - 1b2ecef7b8e6cd5cfb8feb04d0a0cdfe0959c131
blob + d8224f94ec8b9669ac70b38bcaca24aa0ee88a8e
--- gotweb/gotweb.8
+++ gotweb/gotweb.8
@@ -117,7 +117,7 @@ to read Git repositories.
 .It Pa /var/www/htdocs/gotweb/
 Directory containing HTML, CSS, and image files used by
 .Nm .
-.It Pa /var/www/tmp/
+.It Pa /var/www/got/tmp/
 Directory for temporary files created by
 .Nm .
 .El
blob - fbf1ba3c0f1a0375904247bd9bfd7e086e0170e4
blob + 509390f5ba90d758227633a69d2955bf03b31c83
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
@@ -296,8 +296,8 @@ gw_apply_unveil(const char *repo_path)
 	if (repo_path && unveil(repo_path, "r") != 0)
 		return got_error_from_errno2("unveil", repo_path);
 
-	if (unveil("/tmp", "rwc") != 0)
-		return got_error_from_errno2("unveil", "/tmp");
+	if (unveil(GOT_TMPDIR_STR, "rwc") != 0)
+		return got_error_from_errno2("unveil", GOT_TMPDIR_STR);
 
 	err = got_privsep_unveil_exec_helpers();
 	if (err != NULL)
blob - 86beac84b3fe35b60f450a10b4b148f68230b12c
blob + 82d4fbdc322a75119d06855ff7c5d7879bcb9648
--- include/got_opentemp.h
+++ include/got_opentemp.h
@@ -16,6 +16,13 @@
 
 /* Utilities for opening temporary files. */
 
+#ifndef GOT_TMPDIR
+#define GOT_TMPDIR /tmp
+#endif
+#define GOT_STRINGIFY_TMP(x) #x
+#define GOT_STRINGVAL_TMP(x) GOT_STRINGIFY_TMP(x)
+#define GOT_TMPDIR_STR GOT_STRINGVAL_TMP(GOT_TMPDIR)
+
 /* Open a file descriptor to a new temporary file for writing.
  * The file is not visible in the filesystem. */
 int got_opentempfd(void);
blob - eacaf1a7f3ccc47ab7512066e3311a1ab920f74f
blob + e8abac2b786a871bc96f7a2ed6139d694da417c1
--- include/got_version.h
+++ include/got_version.h
@@ -18,10 +18,10 @@
 #error "GOT_VERSION is undefined"
 #endif
 
-#define GOT_STRINGIFY(x) #x
-#define GOT_STRINGVAL(x) GOT_STRINGIFY(x)
+#define GOT_STRINGIFY_VERSION(x) #x
+#define GOT_STRINGVAL_VERSION(x) GOT_STRINGIFY_VERSION(x)
 
-#define GOT_VERSION_STR GOT_STRINGVAL(GOT_VERSION)
+#define GOT_VERSION_STR GOT_STRINGVAL_VERSION(GOT_VERSION)
 
 static inline void
 got_version_print_str(void)
blob - 9d0709eb4d2d110de78403c122946c401dcc43d0
blob + f17c676ca747debbb6b3004920d6d5712cef2810
--- lib/diff3.c
+++ lib/diff3.c
@@ -219,7 +219,8 @@ diffreg(BUF **d, const char *path1, const char *path2)
 		goto done;
 	}
 
-	err = got_opentemp_named(&outpath, &outfile, "/tmp/got-diffreg");
+	err = got_opentemp_named(&outpath, &outfile,
+	    GOT_TMPDIR_STR "/got-diffreg");
 	if (err)
 		goto done;
 
@@ -305,15 +306,15 @@ got_merge_diff3(int *overlapcnt, int outfd, const char
 	if (err)
 		goto out;
 
-	if (asprintf(&path1, "/tmp/got-diff1.XXXXXXXX") == -1) {
+	if (asprintf(&path1, GOT_TMPDIR_STR "/got-diff1.XXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
-	if (asprintf(&path2, "/tmp/got-diff2.XXXXXXXX") == -1) {
+	if (asprintf(&path2, GOT_TMPDIR_STR "/got-diff2.XXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
-	if (asprintf(&path3, "/tmp/got-diff3.XXXXXXXX") == -1) {
+	if (asprintf(&path3, GOT_TMPDIR_STR "/got-diff3.XXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
@@ -345,7 +346,7 @@ got_merge_diff3(int *overlapcnt, int outfd, const char
 		goto out;
 	}
 
-	if (asprintf(&dp13, "/tmp/got-d13.XXXXXXXXXX") == -1) {
+	if (asprintf(&dp13, GOT_TMPDIR_STR "/got-d13.XXXXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
@@ -356,7 +357,7 @@ got_merge_diff3(int *overlapcnt, int outfd, const char
 	buf_free(d1);
 	d1 = NULL;
 
-	if (asprintf(&dp23, "/tmp/got-d23.XXXXXXXXXX") == -1) {
+	if (asprintf(&dp23, GOT_TMPDIR_STR "/got-d23.XXXXXXXXXX") == -1) {
 		err = got_error_from_errno("asprintf");
 		goto out;
 	}
blob - 8476310b72754058ce034bd77807a92b52b4e810
blob + 9bc6f86bc623cc346d7abe1cb6bb4d31aa817b0d
--- lib/opentemp.c
+++ lib/opentemp.c
@@ -29,7 +29,8 @@ got_opentempfd(void)
 	char name[PATH_MAX];
 	int fd;
 
-	if (strlcpy(name, "/tmp/got.XXXXXXXX", sizeof(name)) >= sizeof(name))
+	if (strlcpy(name, GOT_TMPDIR_STR "/got.XXXXXXXX", sizeof(name))
+	    >= sizeof(name))
 		return -1;
 
 	fd = mkstemp(name);
blob - 5f086a5558ca0997cb705fa354cdcf4e673e29b3
blob + 0ee8340a74100f52a328596febc5de2ef96554f4
--- regress/delta/delta_test.c
+++ regress/delta/delta_test.c
@@ -137,7 +137,7 @@ main(int argc, const char *argv[])
 	if (pledge("stdio rpath wpath cpath unveil", NULL) == -1)
 		err(1, "pledge");
 #endif
-	if (unveil("/tmp", "rwc") != 0)
+	if (unveil(GOT_TMPDIR_STR, "rwc") != 0)
 		err(1, "unveil");
 
 	if (unveil(NULL, NULL) != 0)
blob - ca4cead9c16398f8662b7c5b5962f54b0a506979
blob + e6738ac5e9b14ed9d1aa6b41c1f647dbb94ee5a9
--- tog/tog.c
+++ tog/tog.c
@@ -2466,8 +2466,8 @@ apply_unveil(const char *repo_path, const char *worktr
 	if (worktree_path && unveil(worktree_path, "rwc") != 0)
 		return got_error_from_errno2("unveil", worktree_path);
 
-	if (unveil("/tmp", "rwc") != 0)
-		return got_error_from_errno2("unveil", "/tmp");
+	if (unveil(GOT_TMPDIR_STR, "rwc") != 0)
+		return got_error_from_errno2("unveil", GOT_TMPDIR_STR);
 
 	error = got_privsep_unveil_exec_helpers();
 	if (error != NULL)