diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2021-06-10 23:16:22 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2021-06-10 23:16:22 -0400 |
commit | 39d7cea180c3571d79d74d4efcd0efd9f820b53a (patch) | |
tree | 74c4c15b5b2ab430f598c19d21b224e6c4728071 /pullreqd.c | |
parent | ec34e9ce8a380df87dbf5b455b62e805c00ca8d3 (diff) |
Added the `cleanup()`, and `cleanup_config()`
functions.
Diffstat (limited to 'pullreqd.c')
-rw-r--r-- | pullreqd.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -110,6 +110,22 @@ int main_loop(config *cfg, int listen_socket) { for (; !done;) { break; } + + return 0; +} + +void cleanup(config *cfg, int listen_socket) { + if (listen_socket > 0) { + close(listen_socket); + /* Is this a unix domain socket? */ + if (!strcasecmp(cfg->sock_type, "unix")) { + unlink(cfg->sock); + } + } + + if (cfg) { + cleanup_config(cfg); + } } int main(int argc, char **argv) { @@ -136,9 +152,11 @@ int main(int argc, char **argv) { exit_status = main_loop(cfg, listen_socket); } + cleanup(cfg, listen_socket); + syslog(LOG_NOTICE, "pullreqd stopped."); closelog(); - return EXIT_SUCCESS; + return exit_status; } |