]> the.earth.li Git - onak.git/commitdiff
Send close command when cleaning up keyd backend
authorJonathan McDowell <noodles@earth.li>
Tue, 15 Mar 2011 04:29:50 +0000 (21:29 -0700)
committerJonathan McDowell <noodles@earth.li>
Tue, 15 Mar 2011 04:29:50 +0000 (21:29 -0700)
  Previously we just shutdown the socket; we should really tell keyd
  we're disappearing as well.

keydb_keyd.c

index 3f199bd8c09d319c66344a8f842fdb1fa39a0971..dcdcb85f3669eeb6919a92de3dedefd7cec5a3cd 100644 (file)
@@ -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);