diff options
-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."); |