commit 01a217a7bc691f0ebc7c9f5cc36059b5a9077ee2 from: Mark Jamsek via: Thomas Adam date: Tue Feb 07 20:14:55 2023 UTC fix gotd build Add missing srcs and update got_repo_read_gitconfig() to be consistent with recent changes. ok stsp@ commit - 8d0dceb3d76a815a8fbae32091159f8db5672d86 commit + 01a217a7bc691f0ebc7c9f5cc36059b5a9077ee2 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 - 74f445bb30a4f803f490084045cdd29467e82779 blob + 178085a6d3a9da157f1c058c93758a7f8607f13f --- lib/read_gitconfig.c +++ lib/read_gitconfig.c @@ -52,8 +52,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; @@ -63,8 +63,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; @@ -91,7 +93,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; @@ -100,22 +102,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)++; } } @@ -248,11 +263,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) {