commit 8182bd343dfc2c182dd3ac5384515785d531bf2b from: Tracey Emery date: Mon Feb 17 17:11:26 2020 UTC close potentially left open directory during an error condition commit - 85993e64e5ae8fab33cece26e3628509d56f9ec7 commit + 8182bd343dfc2c182dd3ac5384515785d531bf2b blob - b6a5311103d7d189b20a62bbe55ba495fd3b4b00 blob + 16847fa180829d337e301ad16215cee73b512e26 --- gotweb/gotweb.c +++ gotweb/gotweb.c @@ -1655,7 +1655,7 @@ gw_load_got_paths(struct gw_trans *gw_trans) if (d_cnt == -1) { error = got_error_from_errno2("scandir", gw_trans->gw_conf->got_repos_path); - return error; + goto done; } for (d_i = 0; d_i < d_cnt; d_i++) { @@ -1669,7 +1669,7 @@ gw_load_got_paths(struct gw_trans *gw_trans) error = gw_init_gw_dir(&gw_dir, sd_dent[d_i]->d_name); if (error) - return error; + goto done; error = gw_load_got_path(gw_trans, gw_dir); if (error && error->code == GOT_ERR_NOT_GIT_REPO) { @@ -1677,7 +1677,7 @@ gw_load_got_paths(struct gw_trans *gw_trans) continue; } else if (error) - return error; + goto done; if (lstat(gw_dir->path, &st) == 0 && S_ISDIR(st.st_mode) && !got_path_dir_is_empty(gw_dir->path)) { @@ -1686,7 +1686,7 @@ gw_load_got_paths(struct gw_trans *gw_trans) gw_trans->repos_total++; } } - +done: closedir(d); return error; }