commit 54415d85f1bbe99a1740cbad8ec7727c205c913b from: Tracey Emery date: Wed Jan 15 22:10:31 2020 UTC kn@ and stsp@ suggested changes commit - 0311ce2d4be6afdc860372e7780ea417bf3dcc16 commit + 54415d85f1bbe99a1740cbad8ec7727c205c913b blob - ed241a51a70f1885bc59f89cb7f41f4ce53b66bb blob + 485f7795b24965c4e263fc3a834a5eec78ed3dc8 --- Makefile +++ Makefile @@ -3,7 +3,10 @@ SUBDIR = libexec got tog .PHONY: release dist .if make(regress) || make(obj) || make(clean) || make(release) -SUBDIR += regress gotweb +SUBDIR += regress +# not part of original SUBDIR, since we don't build gotweb by default and +# the port will be split into sub packages +SUBDIR += gotweb .endif .include "got-version.mk" @@ -26,13 +29,9 @@ dist: clean rm got-dist.txt.new web: - sed -i -e "s/MAKEWEB=No/MAKEWEB=Yes/" got-version.mk - ${MAKE} -C gotweb - sed -i -e "s/MAKEWEB=Yes/MAKEWEB=No/" got-version.mk + ${MAKE} -C gotweb MAKEWEB=Yes web-install: - sed -i -e "s/MAKEWEB=No/MAKEWEB=Yes/" got-version.mk - ${MAKE} -C gotweb install - sed -i -e "s/MAKEWEB=Yes/MAKEWEB=No/" got-version.mk + ${MAKE} -C gotweb install MAKEWEB=Yes .include blob - 92bb0fe0dfb2d9c4a0c0a77e31b6e0b719a28fbf blob + 5952e3a5a65f7ea0e2162c8fd9ca8149013167c7 --- Makefile.inc +++ Makefile.inc @@ -28,7 +28,7 @@ DEBUG = -O0 -g .endif -.if ${MAKEWEB} == "Yes" +.if "${MAKEWEB}" == "Yes" LDADD = -L${PREFIX}/lib -static -lkcgihtml -lkcgi -lz -lutil PREFIX = /usr/local CHROOT_DIR = /var/www @@ -42,4 +42,6 @@ TMP_DIR = ${CHROOT_DIR}/tmp PROG_DIR = ${HTTPD_DIR}/${PROG} CGI_DIR = ${CHROOT_DIR}${GOTWEB_DIR} TMPL_DIR = ${CGI_DIR}/gw_tmpl +WWWUSR ?= www +WWWGRP ?= www .endif blob - c865312166b95b41acd5cf9a60547d5c139e4969 blob + fd425d052296f3a5e070b8a5babbb5c0c2a11a6d --- gotweb/Makefile +++ gotweb/Makefile @@ -25,28 +25,31 @@ realinstall: if [ ! -d ${CGI_DIR}/. ]; then \ ${INSTALL} -d -o root -g daemon -m 755 ${CGI_DIR}; \ fi - ${INSTALL} -c -o www -g www -m 0755 ${PROG} ${CGI_DIR}/${PROG} + ${INSTALL} -c -o ${WWWUSR} -g ${WWWGRP} -m 0755 ${PROG} \ + ${CGI_DIR}/${PROG} if [ ! -d ${TMPL_DIR}/. ]; then \ ${INSTALL} -d -o root -g daemon -m 755 ${TMPL_DIR}; \ fi - ${INSTALL} -c -o www -g www -m 0755 files/cgi-bin/gw_tmpl/* ${TMPL_DIR} + ${INSTALL} -c -o ${WWWUSR} -g ${WWWGRP} -m 0755 \ + files/cgi-bin/gw_tmpl/* ${TMPL_DIR} if [ ! -d ${ETC_DIR}/. ]; then \ ${INSTALL} -d -o root -g daemon -m 755 ${ETC_DIR}; \ fi if [ ! -d ${EXPL_DIR}/. ]; then \ ${INSTALL} -d -o root -g daemon -m 755 ${EXPL_DIR}; \ fi - ${INSTALL} -c -o www -g www -m 0755 files/etc/gotweb.conf \ + ${INSTALL} -c -o ${WWWUSR} -g ${WWWGRP} -m 0755 files/etc/gotweb.conf \ ${ETC_DIR}/examples/gotweb.conf if [ ! -d ${HTTPD_DIR}/. ]; then \ ${INSTALL} -d -o root -g daemon -m 755 ${HTTPD_DIR}; \ fi if [ ! -d ${TMP_DIR}/. ]; then \ - ${INSTALL} -d -o www -g www -m 755 ${TMP_DIR}; \ + ${INSTALL} -d -o ${WWWUSR} -g ${WWWGRP} -m 755 ${TMP_DIR}; \ fi if [ ! -d ${PROG_DIR}/. ]; then \ ${INSTALL} -d -o root -g daemon -m 755 ${PROG_DIR}; \ fi - ${INSTALL} -c -o www -g www -m 0755 files/htdocs/${PROG}/* ${PROG_DIR} + ${INSTALL} -c -o ${WWWUSR} -g ${WWWGRP} -m 0755 files/htdocs/${PROG}/* \ + ${PROG_DIR} .include blob - c63ca834be73da69a2851808511a8bada49b3d10 blob + af0950e4213a3507ef4d5d791c12dc953de5de14 --- gotweb/README +++ gotweb/README @@ -18,13 +18,6 @@ Man page files in the Gotweb source tree can be viewed $ man -l gotweb/gotweb.conf.5 -Guidelines for reporting problems: - -Report all Gotweb problems in as much detail as possible. Gotweb code is not -covered by automated tests. - -Mail problem reports to: gameoftrees@openbsd.org - Example configuration for httpd.conf: ext_if = "*" @@ -51,7 +44,6 @@ Mail patches to: gameoftrees@openbsd.org Pull requests via any Git hosting sites will likely be overlooked. Please keep the intended target audience in mind when contributing to Gotweb. - Subscribing to the gameoftrees@openbsd.org mailing list: The mailing list is used for patch reviews, bug reports, and user questions. blob - b97f4eacd06f57e7b8ec72b90d06f2e2de2f3162 blob + e9bf1112512b6891de374aecc2893fbc0ea798da --- gotweb/gotweb.c +++ gotweb/gotweb.c @@ -53,7 +53,7 @@ #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif -struct trans { +struct gw_trans { TAILQ_HEAD(dirs, gw_dir) gw_dirs; struct gw_dir *gw_dir; struct gotweb_conf *gw_conf; @@ -94,7 +94,7 @@ struct gw_dir { char *path; }; -enum tmpl { +enum gw_tmpl { TEMPL_HEAD, TEMPL_HEADER, TEMPL_SITEPATH, @@ -105,12 +105,12 @@ enum tmpl { TEMPL__MAX }; -enum ref_tm { +enum gw_ref_tm { TM_DIFF, TM_LONG, }; -enum logs { +enum gw_logs { LOGBRIEF, LOGCOMMIT, LOGFULL, @@ -120,18 +120,12 @@ enum logs { LOGTAG, }; -enum tags { +enum gw_tags { TAGBRIEF, TAGFULL, }; -struct buf { - u_char *cb_buf; - size_t cb_size; - size_t cb_len; -}; - -static const char *const templs[TEMPL__MAX] = { +static const char *const gw_templs[TEMPL__MAX] = { "head", "header", "sitepath", @@ -151,42 +145,44 @@ static const struct kvalid gw_keys[KEY__ZMAX] = { { kvalid_stringne, "path" }, }; -int gw_get_repo_log_count(struct trans *, char *); +int gw_get_repo_log_count(struct gw_trans *, char *); static struct gw_dir *gw_init_gw_dir(char *); -static char *gw_get_repo_description(struct trans *, +static char *gw_get_repo_description(struct gw_trans *, char *); -static char *gw_get_repo_owner(struct trans *, +static char *gw_get_repo_owner(struct gw_trans *, char *); static char *gw_get_time_str(time_t, int); -static char *gw_get_repo_age(struct trans *, +static char *gw_get_repo_age(struct gw_trans *, char *, char *, int); -static char *gw_get_repo_log(struct trans *, const char *, +static char *gw_get_repo_log(struct gw_trans *, const char *, char *, int, int); -static char *gw_get_file_blame(struct trans *, char *); -static char *gw_get_repo_tree(struct trans *, char *); -static char *gw_get_repo_diff(struct trans *, char *, +static char *gw_get_file_blame(struct gw_trans *, char *); +static char *gw_get_repo_tree(struct gw_trans *, char *); +static char *gw_get_repo_diff(struct gw_trans *, char *, char *); -static char *gw_get_repo_tags(struct trans *, int, int); -static char *gw_get_repo_heads(struct trans *); -static char *gw_get_clone_url(struct trans *, char *); -static char *gw_get_got_link(struct trans *); -static char *gw_get_site_link(struct trans *); +static char *gw_get_repo_tags(struct gw_trans *, int, int); +static char *gw_get_repo_heads(struct gw_trans *); +static char *gw_get_clone_url(struct gw_trans *, char *); +static char *gw_get_got_link(struct gw_trans *); +static char *gw_get_site_link(struct gw_trans *); static char *gw_html_escape(const char *); static char *color_diff_line(char *); -static void gw_display_open(struct trans *, enum khttp, +static void gw_display_open(struct gw_trans *, enum khttp, enum kmime); -static void gw_display_index(struct trans *, +static void gw_display_index(struct gw_trans *, const struct got_error *); static int gw_template(size_t, void *); -static const struct got_error* apply_unveil(const char *, const char *); +static const struct got_error* gw_apply_unveil(const char *, const char *); static const struct got_error* cmp_tags(void *, int *, struct got_reference *, struct got_reference *); + +/* got_repo_resolve_commit_arg */ static const struct got_error* resolve_commit_arg(struct got_object_id **, const char *, struct got_repository *); static const struct got_error* match_object_id(struct got_object_id **, @@ -194,28 +190,28 @@ static const struct got_error* match_object_id(struct struct got_repository *); static const struct got_error* blame_cb(void *, int, int, struct got_object_id *); -static const struct got_error* gw_load_got_paths(struct trans *); -static const struct got_error* gw_load_got_path(struct trans *, +static const struct got_error* gw_load_got_paths(struct gw_trans *); +static const struct got_error* gw_load_got_path(struct gw_trans *, struct gw_dir *); -static const struct got_error* gw_parse_querystring(struct trans *); +static const struct got_error* gw_parse_querystring(struct gw_trans *); static const struct got_error* match_logmsg(int *, struct got_object_id *, struct got_commit_object *, regex_t *); -static const struct got_error* gw_blame(struct trans *); -static const struct got_error* gw_commit(struct trans *); -static const struct got_error* gw_commitdiff(struct trans *); -static const struct got_error* gw_index(struct trans *); -static const struct got_error* gw_log(struct trans *); -static const struct got_error* gw_raw(struct trans *); -static const struct got_error* gw_logbriefs(struct trans *); -static const struct got_error* gw_summary(struct trans *); -static const struct got_error* gw_tag(struct trans *); -static const struct got_error* gw_tree(struct trans *); +static const struct got_error* gw_blame(struct gw_trans *); +static const struct got_error* gw_commit(struct gw_trans *); +static const struct got_error* gw_commitdiff(struct gw_trans *); +static const struct got_error* gw_index(struct gw_trans *); +static const struct got_error* gw_log(struct gw_trans *); +static const struct got_error* gw_raw(struct gw_trans *); +static const struct got_error* gw_logbriefs(struct gw_trans *); +static const struct got_error* gw_summary(struct gw_trans *); +static const struct got_error* gw_tag(struct gw_trans *); +static const struct got_error* gw_tree(struct gw_trans *); struct gw_query_action { unsigned int func_id; const char *func_name; - const struct got_error *(*func_main)(struct trans *); + const struct got_error *(*func_main)(struct gw_trans *); char *template; }; @@ -248,7 +244,7 @@ static struct gw_query_action gw_query_funcs[] = { }; static const struct got_error * -apply_unveil(const char *repo_path, const char *repo_file) +gw_apply_unveil(const char *repo_path, const char *repo_file) { const struct got_error *err; @@ -414,7 +410,7 @@ done: } int -gw_get_repo_log_count(struct trans *gw_trans, char *start_commit) +gw_get_repo_log_count(struct gw_trans *gw_trans, char *start_commit) { const struct got_error *error; struct got_repository *repo = NULL; @@ -553,13 +549,13 @@ done: } static const struct got_error * -gw_blame(struct trans *gw_trans) +gw_blame(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *log, *log_html; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -576,12 +572,12 @@ gw_blame(struct trans *gw_trans) } static const struct got_error * -gw_commit(struct trans *gw_trans) +gw_commit(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *log, *log_html; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -598,12 +594,12 @@ gw_commit(struct trans *gw_trans) } static const struct got_error * -gw_commitdiff(struct trans *gw_trans) +gw_commitdiff(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *log, *log_html; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -620,14 +616,14 @@ gw_commitdiff(struct trans *gw_trans) } static const struct got_error * -gw_index(struct trans *gw_trans) +gw_index(struct gw_trans *gw_trans) { const struct got_error *error = NULL; struct gw_dir *gw_dir = NULL; char *html, *navs, *next, *prev; unsigned int prev_disp = 0, next_disp = 1, dir_c = 0; - error = apply_unveil(gw_trans->gw_conf->got_repos_path, NULL); + error = gw_apply_unveil(gw_trans->gw_conf->got_repos_path, NULL); if (error) return error; @@ -712,12 +708,12 @@ gw_index(struct trans *gw_trans) } static const struct got_error * -gw_log(struct trans *gw_trans) +gw_log(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *log, *log_html; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -735,7 +731,7 @@ gw_log(struct trans *gw_trans) } static const struct got_error * -gw_raw(struct trans *gw_trans) +gw_raw(struct gw_trans *gw_trans) { const struct got_error *error = NULL; @@ -743,12 +739,12 @@ gw_raw(struct trans *gw_trans) } static const struct got_error * -gw_logbriefs(struct trans *gw_trans) +gw_logbriefs(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *log, *log_html; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -767,14 +763,14 @@ gw_logbriefs(struct trans *gw_trans) } static const struct got_error * -gw_summary(struct trans *gw_trans) +gw_summary(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *description_html, *repo_owner_html, *repo_age_html, *cloneurl_html, *log, *log_html, *tags, *heads, *tags_html, *heads_html, *age; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -863,12 +859,12 @@ gw_summary(struct trans *gw_trans) } static const struct got_error * -gw_tag(struct trans *gw_trans) +gw_tag(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *log, *log_html; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -885,12 +881,12 @@ gw_tag(struct trans *gw_trans) } static const struct got_error * -gw_tree(struct trans *gw_trans) +gw_tree(struct gw_trans *gw_trans) { const struct got_error *error = NULL; char *log, *log_html; - error = apply_unveil(gw_trans->gw_dir->path, NULL); + error = gw_apply_unveil(gw_trans->gw_dir->path, NULL); if (error) return error; @@ -907,7 +903,7 @@ gw_tree(struct trans *gw_trans) } static const struct got_error * -gw_load_got_path(struct trans *gw_trans, struct gw_dir *gw_dir) +gw_load_got_path(struct gw_trans *gw_trans, struct gw_dir *gw_dir) { const struct got_error *error = NULL; DIR *dt; @@ -964,7 +960,7 @@ errored: } static const struct got_error * -gw_load_got_paths(struct trans *gw_trans) +gw_load_got_paths(struct gw_trans *gw_trans) { const struct got_error *error = NULL; DIR *d; @@ -1019,7 +1015,7 @@ gw_load_got_paths(struct trans *gw_trans) } static const struct got_error * -gw_parse_querystring(struct trans *gw_trans) +gw_parse_querystring(struct gw_trans *gw_trans) { const struct got_error *error = NULL; struct kpair *p; @@ -1144,7 +1140,7 @@ done: } static void -gw_display_open(struct trans *gw_trans, enum khttp code, enum kmime mime) +gw_display_open(struct gw_trans *gw_trans, enum khttp code, enum kmime mime) { khttp_head(gw_trans->gw_req, kresps[KRESP_ALLOW], "GET"); khttp_head(gw_trans->gw_req, kresps[KRESP_STATUS], "%s", @@ -1158,7 +1154,7 @@ gw_display_open(struct trans *gw_trans, enum khttp cod } static void -gw_display_index(struct trans *gw_trans, const struct got_error *err) +gw_display_index(struct gw_trans *gw_trans, const struct got_error *err) { gw_display_open(gw_trans, KHTTP_200, gw_trans->mime); khtml_open(gw_trans->gw_html_req, gw_trans->gw_req, 0); @@ -1176,7 +1172,7 @@ static int gw_template(size_t key, void *arg) { const struct got_error *error = NULL; - struct trans *gw_trans = arg; + struct gw_trans *gw_trans = arg; char *gw_got_link, *gw_site_link; char *site_owner_name, *site_owner_name_h; @@ -1236,7 +1232,7 @@ gw_template(size_t key, void *arg) } static char * -gw_get_repo_description(struct trans *gw_trans, char *dir) +gw_get_repo_description(struct gw_trans *gw_trans, char *dir) { FILE *f; char *description = NULL, *d_file = NULL; @@ -1333,7 +1329,7 @@ gw_get_time_str(time_t committer_time, int ref_tm) } static char * -gw_get_repo_age(struct trans *gw_trans, char *dir, char *repo_ref, int ref_tm) +gw_get_repo_age(struct gw_trans *gw_trans, char *dir, char *repo_ref, int ref_tm) { const struct got_error *error = NULL; struct got_object_id *id = NULL; @@ -1415,7 +1411,7 @@ err: } static char * -gw_get_repo_diff(struct trans *gw_trans, char *id_str1, char *id_str2) +gw_get_repo_diff(struct gw_trans *gw_trans, char *id_str1, char *id_str2) { const struct got_error *error; FILE *f = NULL; @@ -1519,7 +1515,7 @@ done: } static char * -gw_get_repo_owner(struct trans *gw_trans, char *dir) +gw_get_repo_owner(struct gw_trans *gw_trans, char *dir) { FILE *f; char *owner = NULL, *d_file = NULL; @@ -1578,7 +1574,7 @@ err: } static char * -gw_get_clone_url(struct trans *gw_trans, char *dir) +gw_get_clone_url(struct gw_trans *gw_trans, char *dir) { FILE *f; char *url = NULL, *d_file = NULL; @@ -1604,7 +1600,7 @@ gw_get_clone_url(struct trans *gw_trans, char *dir) } static char * -gw_get_repo_log(struct trans *gw_trans, const char *search_pattern, +gw_get_repo_log(struct gw_trans *gw_trans, const char *search_pattern, char *start_commit, int limit, int log_type) { const struct got_error *error; @@ -2137,7 +2133,7 @@ done: } static char * -gw_get_repo_tags(struct trans *gw_trans, int limit, int tag_type) +gw_get_repo_tags(struct gw_trans *gw_trans, int limit, int tag_type) { const struct got_error *error = NULL; struct got_repository *repo = NULL; @@ -2283,7 +2279,7 @@ struct blame_cb_args { off_t *line_offsets; FILE *f; struct got_repository *repo; - struct trans *gw_trans; + struct gw_trans *gw_trans; struct buf *blamebuf; }; @@ -2397,7 +2393,7 @@ done: } static char* -gw_get_file_blame(struct trans *gw_trans, char *commit_str) +gw_get_file_blame(struct gw_trans *gw_trans, char *commit_str) { const struct got_error *error = NULL; struct got_repository *repo = NULL; @@ -2528,7 +2524,7 @@ done: } static char* -gw_get_repo_tree(struct trans *gw_trans, char *commit_str) +gw_get_repo_tree(struct gw_trans *gw_trans, char *commit_str) { const struct got_error *error = NULL; struct got_repository *repo = NULL; @@ -2692,7 +2688,7 @@ done: } static char * -gw_get_repo_heads(struct trans *gw_trans) +gw_get_repo_heads(struct gw_trans *gw_trans) { const struct got_error *error = NULL; struct got_repository *repo = NULL; @@ -2772,7 +2768,7 @@ done: } static char * -gw_get_got_link(struct trans *gw_trans) +gw_get_got_link(struct gw_trans *gw_trans) { char *link; @@ -2784,7 +2780,7 @@ gw_get_got_link(struct trans *gw_trans) } static char * -gw_get_site_link(struct trans *gw_trans) +gw_get_site_link(struct gw_trans *gw_trans) { char *link, *repo = "", *action = ""; @@ -2918,12 +2914,12 @@ int main() { const struct got_error *error = NULL; - struct trans *gw_trans; + struct gw_trans *gw_trans; struct gw_dir *dir = NULL, *tdir; const char *page = "index"; int gw_malloc = 1; - if ((gw_trans = malloc(sizeof(struct trans))) == NULL) + if ((gw_trans = malloc(sizeof(struct gw_trans))) == NULL) errx(1, "malloc"); if ((gw_trans->gw_req = malloc(sizeof(struct kreq))) == NULL) @@ -2960,7 +2956,7 @@ main() gw_trans->commit = NULL; gw_trans->headref = strdup(GOT_REF_HEAD); gw_trans->mime = KMIME_TEXT_HTML; - gw_trans->gw_tmpl->key = templs; + gw_trans->gw_tmpl->key = gw_templs; gw_trans->gw_tmpl->keysz = TEMPL__MAX; gw_trans->gw_tmpl->arg = gw_trans; gw_trans->gw_tmpl->cb = gw_template; blob - f066d2df1f07bdd931a62cbdb7fb00a3b9bd4989 blob + 0101a26c39257f2f4b72dda5d9f1f52dcf5945b8 --- gotweb/parse.y +++ gotweb/parse.y @@ -105,35 +105,35 @@ boolean : STRING { ; main : GOT_REPOS_PATH STRING { - if ((gw_conf->got_repos_path = strdup($2)) == NULL) + if ((gw_conf->got_repos_path = strdup($2)) == NULL) errx(1, "out of memory"); - } + } | GOT_WWW_PATH STRING { - if ((gw_conf->got_www_path = strdup($2)) == NULL) + if ((gw_conf->got_www_path = strdup($2)) == NULL) errx(1, "out of memory"); - } + } | GOT_MAX_REPOS NUMBER { if ($2 > 0) gw_conf->got_max_repos = $2; } | GOT_SITE_NAME STRING { - if ((gw_conf->got_site_name = strdup($2)) == NULL) + if ((gw_conf->got_site_name = strdup($2)) == NULL) errx(1, "out of memory"); } | GOT_SITE_OWNER STRING { - if ((gw_conf->got_site_owner = strdup($2)) == NULL) + if ((gw_conf->got_site_owner = strdup($2)) == NULL) errx(1, "out of memory"); } | GOT_SITE_LINK STRING { - if ((gw_conf->got_site_link = strdup($2)) == NULL) + if ((gw_conf->got_site_link = strdup($2)) == NULL) errx(1, "out of memory"); } | GOT_LOGO STRING { - if ((gw_conf->got_logo = strdup($2)) == NULL) + if ((gw_conf->got_logo = strdup($2)) == NULL) errx(1, "out of memory"); } | GOT_LOGO_URL STRING { - if ((gw_conf->got_logo_url = strdup($2)) == NULL) + if ((gw_conf->got_logo_url = strdup($2)) == NULL) errx(1, "out of memory"); } | GOT_SHOW_SITE_OWNER boolean { @@ -157,7 +157,7 @@ main : GOT_REPOS_PATH STRING { if ($2 > 0) gw_conf->got_max_commits_display = $2; } - ; + ; %% @@ -488,20 +488,20 @@ parse_conf(const char *filename, struct gotweb_conf *g static const struct got_error* error = NULL; gw_conf = gconf; - if ((gw_conf->got_repos_path = strdup(D_GOTPATH)) == NULL) - errx(1, "out of memory"); - if ((gw_conf->got_www_path = strdup(D_GOTWWW)) == NULL) - errx(1, "out of memory"); - if ((gw_conf->got_site_name = strdup(D_SITENAME)) == NULL) - errx(1, "out of memory"); - if ((gw_conf->got_site_owner = strdup(D_SITEOWNER)) == NULL) - errx(1, "out of memory"); - if ((gw_conf->got_site_link = strdup(D_SITELINK)) == NULL) - errx(1, "out of memory"); - if ((gw_conf->got_logo = strdup(D_GOTLOGO)) == NULL) - errx(1, "out of memory"); - if ((gw_conf->got_logo_url = strdup(D_GOTURL)) == NULL) - errx(1, "out of memory"); + if ((gw_conf->got_repos_path = strdup(D_GOTPATH)) == NULL) + err(1, "strdup"); + if ((gw_conf->got_www_path = strdup(D_GOTWWW)) == NULL) + err(1, "strdup"); + if ((gw_conf->got_site_name = strdup(D_SITENAME)) == NULL) + err(1, "strdup"); + if ((gw_conf->got_site_owner = strdup(D_SITEOWNER)) == NULL) + err(1, "strdup"); + if ((gw_conf->got_site_link = strdup(D_SITELINK)) == NULL) + err(1, "strdup"); + if ((gw_conf->got_logo = strdup(D_GOTLOGO)) == NULL) + err(1, "strdup"); + if ((gw_conf->got_logo_url = strdup(D_GOTURL)) == NULL) + err(1, "strdup"); gw_conf->got_show_site_owner = D_SHOWSOWNER; gw_conf->got_show_repo_owner = D_SHOWROWNER; gw_conf->got_show_repo_age = D_SHOWAGE; blob - 91c180970a37717bdf0225d089992e356b795ebf blob + 3986b23c81fbc180d2bf37f92161e9fd2855949c --- lib/buf.c +++ lib/buf.c @@ -41,13 +41,6 @@ #define BUF_INCR 128 -struct buf { - /* buffer handle, buffer size, and data length */ - u_char *cb_buf; - size_t cb_size; - size_t cb_len; -}; - #define SIZE_LEFT(b) ((b)->cb_size - (b)->cb_len) static const struct got_error *buf_grow(BUF *, size_t); blob - dcb2af974a2d41f07e6f11e91b37d73fd2c04948 blob + 9422c0f343fd6d75cb7d237cc91e732a5f60405e --- lib/buf.h +++ lib/buf.h @@ -42,6 +42,13 @@ typedef struct buf BUF; +struct buf { + /* buffer handle, buffer size, and data length */ + u_char *cb_buf; + size_t cb_size; + size_t cb_len; +}; + const struct got_error *buf_alloc(BUF **, size_t); const struct got_error *buf_load(BUF **, const char *); void buf_free(BUF *); blob - 40fa9cc99ceca8d3d1fe298c1a381c45073a6736 blob + a77207b0535b56fa5a3d0ab83550adb52a2199fa --- libexec/Makefile.inc +++ libexec/Makefile.inc @@ -1,12 +1,13 @@ .include "../Makefile.inc" -.if ${MAKEWEB} == "Yes" +.if "${MAKEWEB}" == "Yes" realinstall: - if [ ! -d ${LIBEXEC_DIR}/. ]; then \ - ${INSTALL} -d -o root -g daemon -m 755 ${LIBEXEC_DIR}; \ + if [ ! -d ${CHROOT_DIR}${LIBEXECDIR}/. ]; then \ + ${INSTALL} -d -o root -g daemon -m 755 \ + ${CHROOT_DIR}${LIBEXECDIR}; \ fi ${INSTALL} ${INSTALL_COPY} -o root -g daemon -m 755 ${PROG} \ - ${LIBEXEC_DIR}/${PROG} + ${CHROOT_DIR}${LIBEXECDIR}/${PROG} .else realinstall: ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \