commit 6c5befc77a38fbe198b99fe0564052ffc0f246a6 from: Stefan Sperling date: Tue Mar 28 10:16:42 2023 UTC require gotsh to exist if the repository is listed in gotd.conf ok op@ commit - afc4e030773225d5e55d42cd14ed017feadfa2fb commit + 6c5befc77a38fbe198b99fe0564052ffc0f246a6 blob - a5d0bcb2233ff202330b3c197e216e3300f272f4 blob + a30589e672a0c2ca735d16a6ecde083ecf754389 --- gitwrapper/gitwrapper.c +++ gitwrapper/gitwrapper.c @@ -177,15 +177,20 @@ main(int argc, char *argv[]) repo = gotd_find_repo_by_name(repo_name, &gotd); /* - * Invoke our custom Git server if it was found in PATH and - * if the repository was found in gotd.conf. - * Otherwise invoke native git(1) tooling. + * Invoke our custom Git server if the repository was found + * in gotd.conf. Otherwise invoke native git(1) tooling. */ switch (pid = fork()) { case -1: goto done; case 0: - if (repo && myserver) { + if (repo) { + if (myserver == NULL) { + error = got_error_fmt(GOT_ERR_NO_PROG, + "cannot run '%s'", + GITWRAPPER_MY_SERVER_PROG); + goto done; + } if (execl(myserver, command, repo_name, (char *)NULL) == -1) { error = got_error_from_errno2("execl", blob - 53f181cbdaef76fe21b918d662302e97c34c6b3b blob + 3b047e438a7e4fff23c4e9f6c1ada623765a80dc --- include/got_error.h +++ include/got_error.h @@ -184,6 +184,7 @@ #define GOT_ERR_COMMIT_BAD_AUTHOR 166 #define GOT_ERR_UID 167 #define GOT_ERR_GID 168 +#define GOT_ERR_NO_PROG 169 struct got_error { int code; blob - 0594e146d2cc9880efb2656076d68077f87407cb blob + 9722f2b79685f6dcd81c590ca357729edac35a25 --- lib/error.c +++ lib/error.c @@ -233,6 +233,7 @@ static const struct got_error got_errors[] = { "make Git unhappy" }, { GOT_ERR_UID, "bad user ID" }, { GOT_ERR_GID, "bad group ID" }, + { GOT_ERR_NO_PROG, "command not found or not accessible" }, }; static struct got_custom_error {