Commit Diff


commit - a72fb3943aac447913520efc133b9b010beb8001
commit + c8fcdde846ed3f6e2694cb0a3f7e6508b32098bf
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)