commit - 4cdd299d8c1d142b26efc3351dbab1c185f2c492
commit + 7e0ec0529553d4a8e236cad41366f79eda5126b3
blob - 29bdf6301687d8ed6e4ae5f52d25ea757efd3176
blob + ec88e1ef5acdb77906f2588283329e2a1f4eda21
--- gotwebd/config.c
+++ gotwebd/config.c
struct privsep *ps = env->gotwebd_ps;
memcpy(&ssrv, srv, sizeof(ssrv));
- proc_compose(ps, PROC_SOCKS, IMSG_CFG_SRV, &ssrv, sizeof(ssrv));
+ if (proc_compose(ps, PROC_SOCKS, IMSG_CFG_SRV, &ssrv, sizeof(ssrv))
+ == -1)
+ fatal("proc_compose");
return 0;
}
srv = calloc(1, sizeof(*srv));
if (srv == NULL)
fatalx("%s: calloc", __func__);
- memcpy(srv, p, sizeof(*srv));
if (IMSG_DATA_SIZE(imsg) != sizeof(*srv)) {
log_debug("%s: imsg size error", __func__);
free(srv);
return 1;
}
+
+ memcpy(srv, p, sizeof(*srv));
+ srv->cached_repos = calloc(GOTWEBD_REPO_CACHESIZE,
+ sizeof(*srv->cached_repos));
+ if (srv->cached_repos == NULL)
+ fatal("%s: calloc", __func__);
+ srv->ncached_repos = 0;
/* log server info */
log_debug("%s: server=%s fcgi_socket=%s unix_socket=%s", __func__,
blob - 401b70e6dff3d9c32b2e251335998950b2a3ee8b
blob + 901ae14aede9ca4142ec96a797bc9259d47a4e78
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
struct cached_repo *cr;
int evicted = 0;
- if (srv->ncached_repos >= nitems(srv->cached_repos)) {
+ if (srv->ncached_repos >= GOTWEBD_REPO_CACHESIZE) {
cr = &srv->cached_repos[srv->ncached_repos - 1];
error = got_repo_close(cr->repo);
memset(cr, 0, sizeof(*cr));
blob - ac7f962b1abdcfe1c535e8bc210c9f619e7a2cbc
blob + f73ea6b8311442f992dbc1c563f90486ef813c04
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
TAILQ_ENTRY(server) entry;
struct addresslist al;
- struct cached_repo cached_repos[GOTWEBD_REPO_CACHESIZE];
+ struct cached_repo *cached_repos;
int ncached_repos;
char name[GOTWEBD_MAXTEXT];