Commit Diff


commit - 87724ba023ff5063a868e68ac90b991ae1cf7ec8
commit + 8edf8796238623ad54b0a73abf83cf2c94a1fb83
blob - fb5f331b5c32503b2fe1e1c4de73a8af9959be9d
blob + b35ab29a7bf7de38825cb9a4cb6b51c291725f48
--- gotsh/gotsh.c
+++ gotsh/gotsh.c
@@ -63,8 +63,7 @@ int
 main(int argc, char *argv[])
 {
 	const struct got_error *error;
-	char unix_socket_path[PATH_MAX];
-	char *unix_socket_path_env = getenv("GOTD_UNIX_SOCKET");
+	const char *unix_socket_path;
 	int gotd_sock = -1;
 	struct sockaddr_un	 sun;
 	char *gitcmd = NULL, *command = NULL, *repo_path = NULL;
@@ -90,14 +89,9 @@ main(int argc, char *argv[])
 	if (error)
 		goto done;
 
-	if (unix_socket_path_env) {
-		if (strlcpy(unix_socket_path, unix_socket_path_env,
-		    sizeof(unix_socket_path)) >= sizeof(unix_socket_path))
-			errx(1, "gotd socket path too long");
-	} else {
-		strlcpy(unix_socket_path, GOTD_UNIX_SOCKET,
-		    sizeof(unix_socket_path));
-	}
+	unix_socket_path = getenv("GOTD_UNIX_SOCKET");
+	if (unix_socket_path == NULL)
+		unix_socket_path = GOTD_UNIX_SOCKET;
 
 	error = apply_unveil(unix_socket_path);
 	if (error)