Commit Diff


commit - 849a2aa4a758b013d39ec99bea96ec4c86e8d1d4
commit + c13168e4b762e0d3808d1c60190a7eb70e27ee8a
blob - 4c1f36d7b4c7b61ced5a157bdb8e09d7f51b4636
blob + 88fdbf3c6940353008b960a1fac5f50fcd1c3ce7
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -1125,28 +1125,20 @@ gotweb_load_got_path(struct request *c, struct repo_di
 	dt = opendir(dir_test);
 	if (dt == NULL) {
 		free(dir_test);
-	} else {
-		repo_dir->path = dir_test;
-		dir_test = NULL;
-		goto open_repo;
-	}
-
-	if (asprintf(&dir_test, "%s/%s", srv->repos_path,
-	    repo_dir->name) == -1) {
-		error = got_error_from_errno("asprintf");
-		goto err;
+		if (asprintf(&dir_test, "%s/%s", srv->repos_path,
+		    repo_dir->name) == -1)
+			return got_error_from_errno("asprintf");
+		dt = opendir(dir_test);
+		if (dt == NULL) {
+			free(dir_test);
+			return got_error_path(repo_dir->name,
+			    GOT_ERR_NOT_GIT_REPO);
+		}
 	}
 
-	dt = opendir(dir_test);
-	if (dt == NULL) {
-		error = got_error_path(repo_dir->name, GOT_ERR_NOT_GIT_REPO);
-		goto err;
-	} else {
-		repo_dir->path = dir_test;
-		dir_test = NULL;
-	}
+	repo_dir->path = dir_test;
+	dir_test = NULL;
 
-open_repo:
 	if (srv->respect_exportok &&
 	    faccessat(dirfd(dt), "git-daemon-export-ok", F_OK, 0) == -1) {
 		error = got_error_path(repo_dir->name, GOT_ERR_NOT_GIT_REPO);