Commit Diff


commit - 6c24d194f2260b073d8e8ad3e756efa3ce20dd2e
commit + 0b16f49bed65694b1fb98f7eb484b700a7001a64
blob - d2d0a46eb54ddaae9597c2b882c9b481e7cf0482
blob + 6eed5edbe0ca8a4cc8d06fe1e24cf4c71e7648f6
--- gotwebd/config.c
+++ gotwebd/config.c
@@ -47,6 +47,8 @@ config_init(struct gotwebd *env)
 {
 	struct privsep *ps = env->gotwebd_ps;
 	unsigned int what;
+
+	strlcpy(env->httpd_chroot, D_HTTPD_CHROOT, sizeof(env->httpd_chroot));
 
 	/* Global configuration. */
 	if (privsep_process == PROC_GOTWEBD)
blob - 4008d67067b944faa3ad59182834a089c26c923d
blob + 3e4b2a555c81619ecce928ac3c126f1996e5586d
--- gotwebd/gotwebd.c
+++ gotwebd/gotwebd.c
@@ -212,8 +212,7 @@ main(int argc, char **argv)
 		ps->ps_title[proc_id] = title;
 
 	for (proc = 0; proc < nitems(procs); proc++)
-		procs[proc].p_chroot = strlen(env->httpd_chroot) ?
-		    env->httpd_chroot : D_HTTPD_CHROOT;
+		procs[proc].p_chroot = env->httpd_chroot;
 
 	/* only the gotwebd returns */
 	proc_init(ps, procs, nitems(procs), argc0, argv, proc_id);
@@ -250,8 +249,7 @@ main(int argc, char **argv)
 		err(1, "gmon.out");
 #endif
 
-	if (unveil(strlen(env->httpd_chroot) > 0 ? env->httpd_chroot :
-	    D_HTTPD_CHROOT, "rwc") == -1)
+	if (unveil(env->httpd_chroot, "rwc") == -1)
 		err(1, "unveil");
 
 	if (unveil(GOT_TMPDIR_STR, "rw") == -1)
blob - f30b23eb629f482ab10caed66d7ca2e332d07756
blob + b42b127d69d3375ec7b60d13ece2d83c19a030b5
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -232,8 +232,7 @@ main		: PREFORK NUMBER {
 		| UNIX_SOCKET_NAME STRING {
 			n = snprintf(gotwebd->unix_socket_name,
 			    sizeof(gotwebd->unix_socket_name), "%s%s",
-			    strlen(gotwebd->httpd_chroot) ?
-			    gotwebd->httpd_chroot : D_HTTPD_CHROOT, $2);
+			    gotwebd->httpd_chroot, $2);
 			if (n < 0 ||
 			    (size_t)n >= sizeof(gotwebd->unix_socket_name)) {
 				yyerror("%s: unix_socket_name truncated",
@@ -365,8 +364,7 @@ serveropts1	: REPOS_PATH STRING {
 
 			n = snprintf(new_srv->unix_socket_name,
 			    sizeof(new_srv->unix_socket_name), "%s%s",
-			    strlen(gotwebd->httpd_chroot) ?
-			    gotwebd->httpd_chroot : D_HTTPD_CHROOT, $4);
+			    gotwebd->httpd_chroot, $4);
 			if (n < 0 ||
 			    (size_t)n >= sizeof(new_srv->unix_socket_name)) {
 				yyerror("%s: unix_socket_name truncated",