commit b0ac38bb75347d8463628704f64f5ff0349272a6 from: Mark Jamsek date: Mon Feb 06 13:18:26 2023 UTC fix gotd build Add missing srcs and update got_repo_read_gitconfig() to be consistent with recent changes. ok stsp@ commit - ccbbf026bf5917a8d66564fcce9184b29412432b commit + b0ac38bb75347d8463628704f64f5ff0349272a6 blob - de99e60620ea466b3e56f258e643d00a974595d6 blob + 079b3c530a2c1681a497b2d74a8c077a1528b18a --- gotctl/Makefile +++ gotctl/Makefile @@ -3,7 +3,8 @@ .include "../got-version.mk" PROG= gotctl -SRCS= gotctl.c error.c imsg.c pollfd.c sha1.c +SRCS= gotctl.c error.c imsg.c inflate.c object_parse.c path.c \ + pollfd.c sha1.c MAN = ${PROG}.8 blob - c4456b3590ca82fd05071e3b28f8372a45371af0 blob + 8cce24717276094756bd1d95fbe9d738ab14a8da --- gotsh/Makefile +++ gotsh/Makefile @@ -4,7 +4,7 @@ PROG= gotsh SRCS= gotsh.c error.c pkt.c sha1.c serve.c path.c gitproto.c \ - imsg.c pollfd.c reference_parse.c + imsg.c inflate.c object_parse.c pollfd.c reference_parse.c MAN = ${PROG}.1 blob - d46762d0f8fd908e9beebe23dd87ff3740db4068 blob + b58507426a87ab346368bdad7903b8c08adb9de1 --- lib/read_gitconfig.c +++ lib/read_gitconfig.c @@ -54,8 +54,8 @@ const struct got_error * got_repo_read_gitconfig(int *gitconfig_repository_format_version, char **gitconfig_author_name, char **gitconfig_author_email, struct got_remote_repo **remotes, int *nremotes, - char **gitconfig_owner, char ***extensions, int *nextensions, - const char *gitconfig_path) + char **gitconfig_owner, char ***extnames, char ***extvals, + int *nextensions, const char *gitconfig_path) { const struct got_error *err = NULL; struct got_gitconfig *gitconfig = NULL; @@ -65,8 +65,10 @@ got_repo_read_gitconfig(int *gitconfig_repository_form const char *author, *email, *owner; *gitconfig_repository_format_version = 0; - if (extensions) - *extensions = NULL; + if (extnames) + *extnames = NULL; + if (extvals) + *extvals = NULL; if (nextensions) *nextensions = 0; *gitconfig_author_name = NULL; @@ -93,7 +95,7 @@ got_repo_read_gitconfig(int *gitconfig_repository_form "core", "repositoryformatversion", 0); tags = got_gitconfig_get_tag_list(gitconfig, "extensions"); - if (extensions && nextensions && tags) { + if (extnames && extvals && nextensions && tags) { size_t numext = 0; TAILQ_FOREACH(node, &tags->fields, link) { char *ext = node->field; @@ -102,22 +104,35 @@ got_repo_read_gitconfig(int *gitconfig_repository_form if (get_boolean_val(val)) numext++; } - *extensions = calloc(numext, sizeof(char *)); - if (*extensions == NULL) { + *extnames = calloc(numext, sizeof(char *)); + if (*extnames == NULL) { err = got_error_from_errno("calloc"); goto done; } + *extvals = calloc(numext, sizeof(char *)); + if (*extvals == NULL) { + err = got_error_from_errno("calloc"); + goto done; + } TAILQ_FOREACH(node, &tags->fields, link) { char *ext = node->field; char *val = got_gitconfig_get_str(gitconfig, "extensions", ext); if (get_boolean_val(val)) { - char *extstr = strdup(ext); + char *extstr = NULL, *valstr = NULL; + + extstr = strdup(ext); if (extstr == NULL) { err = got_error_from_errno("strdup"); goto done; } - (*extensions)[(*nextensions)] = extstr; + valstr = strdup(val); + if (valstr == NULL) { + err = got_error_from_errno("strdup"); + goto done; + } + (*extnames)[(*nextensions)] = extstr; + (*extvals)[(*nextensions)] = valstr; (*nextensions)++; } } @@ -250,11 +265,15 @@ done: if (gitconfig) got_gitconfig_close(gitconfig); if (err) { - if (extensions && nextensions) { - for (i = 0; i < (*nextensions); i++) - free((*extensions)[i]); - free(*extensions); - *extensions = NULL; + if (extnames && extvals && nextensions) { + for (i = 0; i < (*nextensions); i++) { + free((*extnames)[i]); + free((*extvals)[i]); + } + free(*extnames); + *extnames = NULL; + free(*extvals); + *extvals = NULL; *nextensions = 0; } if (remotes && nremotes) {