commit 260fd73e179a3da7600820c158e13bf148dff25f from: Omar Polo date: Fri Dec 01 16:45:13 2023 UTC refactor gotweb_load_got_path; no functional change ok tracey@ commit - 446026cb9332485a4c570afd42fb493d451f7251 commit + 260fd73e179a3da7600820c158e13bf148dff25f blob - af7ddea86d0f5f5e689b53e6aa57e44387ec4a1c blob + e5f7034e08396bd55ab20a409d6dbd8d8acf4c88 --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -1126,28 +1126,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);