commit - 5baa5fe241b3b9bb4bc6f68b06d18ea4094ad579
commit + a004b24a97cfaa2be171871f42cdc15e24fa8682
blob - 2f88b5b88c026d281f733775eca7dac69cc21a04
blob + 041e66818e8cd0f84a1d59fe60801962e8f611b4
--- 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 - 976d5eac6eb1b6d018e514bb87a9afbb78454dc1
blob + af0d01554db2962e1c2daf8b575f7bdf9f067331
--- 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];