diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2021-06-13 19:16:29 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2021-06-13 19:16:29 -0400 |
commit | 19b9e4e9b1aab03865b500fe4277869f98300464 (patch) | |
tree | cdbee830756a68200a1be53b50109ab0ba23d757 /pullreqd.c | |
parent | 88db867437be96e3be1669084bd984babfab2a06 (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.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -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."); |