From: Jonathan McDowell Date: Tue, 15 Mar 2011 04:29:50 +0000 (-0700) Subject: Send close command when cleaning up keyd backend X-Git-Tag: 0.4.0~34 X-Git-Url: https://the.earth.li/gitweb/?a=commitdiff_plain;h=677db9ffe0b9ea79bb52ffacc5ccb964e261093a;p=onak.git Send close command when cleaning up keyd backend Previously we just shutdown the socket; we should really tell keyd we're disappearing as well. --- diff --git a/keydb_keyd.c b/keydb_keyd.c index 3f199bd..dcdcb85 100644 --- a/keydb_keyd.c +++ b/keydb_keyd.c @@ -103,6 +103,15 @@ 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);