X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/38673288bad5b2c0f730021d9311e2df73c74c82..8d14d66b84cc370cefe54b33de1b95bb49c90bf6:/keydb_keyd.c?ds=inline diff --git a/keydb_keyd.c b/keydb_keyd.c index 3f199bd..35d2dc4 100644 --- a/keydb_keyd.c +++ b/keydb_keyd.c @@ -103,10 +103,23 @@ static void keyd_initdb(bool readonly) */ static void keyd_cleanupdb(void) { + int cmd = KEYD_CMD_CLOSE; + + if (write(keyd_fd, &cmd, sizeof(cmd)) != sizeof(cmd)) { + logthing(LOGTHING_CRITICAL, + "Couldn't send close cmd: %s (%d)", + strerror(errno), + errno); + } + if (shutdown(keyd_fd, SHUT_RDWR) < 0) { logthing(LOGTHING_NOTICE, "Error shutting down socket: %d", errno); } + if (close(keyd_fd) < 0) { + logthing(LOGTHING_NOTICE, "Error closing down socket: %d", + errno); + } keyd_fd = -1; return;