summaryrefslogtreecommitdiff
path: root/pullreqd.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-06-13 19:16:29 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2021-06-13 19:16:29 -0400
commit19b9e4e9b1aab03865b500fe4277869f98300464 (patch)
treecdbee830756a68200a1be53b50109ab0ba23d757 /pullreqd.c
parent88db867437be96e3be1669084bd984babfab2a06 (diff)
Added the `repos` parameter to both `main_loop()`, and
`cleanup()`, and also call the git initialization code in the main program.
Diffstat (limited to 'pullreqd.c')
-rw-r--r--pullreqd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/pullreqd.c b/pullreqd.c
index 15d05f3..ccd1fb3 100644
--- a/pullreqd.c
+++ b/pullreqd.c
@@ -162,7 +162,7 @@ int init_socket(config *cfg) {
return fd;
}
-int main_loop(config *cfg, int listen_socket) {
+int main_loop(config *cfg, int listen_socket, git_repository **repos) {
int done = 0;
for (; !done;) {
@@ -172,7 +172,7 @@ int main_loop(config *cfg, int listen_socket) {
return 0;
}
-void cleanup(config *cfg, int listen_socket) {
+void cleanup(config *cfg, int listen_socket, git_repository **repos) {
if (listen_socket > 0) {
close(listen_socket);
/* Is this a unix domain socket? */
@@ -184,10 +184,15 @@ void cleanup(config *cfg, int listen_socket) {
if (cfg) {
cleanup_config(cfg);
}
+
+ if (repos) {
+ cleanup_git(repos);
+ }
}
int main(int argc, char **argv) {
config *cfg;
+ git_repository **repos;
char *config_file = "test.conf";
int config_read = 0;
int listen_socket = -1;
@@ -207,10 +212,13 @@ int main(int argc, char **argv) {
/* Did we successfully read the config file, and create the listen socket? */
if (config_read && listen_socket >= 0) {
- exit_status = main_loop(cfg, listen_socket);
+ repos = init_git(cfg);
+ if (repos != NULL) {
+ exit_status = main_loop(cfg, listen_socket, repos);
+ }
}
- cleanup(cfg, listen_socket);
+ cleanup(cfg, listen_socket, repos);
log(LOG_NOTICE, "pullreqd stopped.");