Commit Diff


commit - a54a1cc9b4d864630967dc6fcdca0456efd5577a8d5e7d9fcdc0d5d5689dfd68
commit + e6436a3ca5a32f64391f231b96417490fea680f9f5255f21f7629c17316f4727
blob - 22ffa8f8c5ed91f8ce007304cf40f1667b914f563280134c6b79970a9009625a
blob + 5704c4f57617531be3fffd6c3368db367832433c6a06ef716caa80485e178dc1
--- gotwebd/gotweb.c	
+++ gotwebd/gotweb.c	
@@ -1009,11 +1009,9 @@ gotweb_load_got_path(struct repo_dir **rp, const char 
 	repo_dir->path = dir_test;
 	dir_test = NULL;
 
-	repo_dir->name = strdup(repo_dir->path + strlen(srv->repos_path) + 1);
-	if (repo_dir->name == NULL) {
-		error = got_error_from_errno("strdup");
+	error = got_path_basename(&repo_dir->name, repo_dir->path);
+	if (error)
 		goto err;
-	}
 
 	if (srv->respect_exportok &&
 	    faccessat(dirfd(dt), "git-daemon-export-ok", F_OK, 0) == -1) {