X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/5b3f77c7fbafb036d20a1577ed74f475e94ed821..a534b3b856a1e3cbfe60bc0bca432e802f9718be:/keyd.c diff --git a/keyd.c b/keyd.c index d6abd32..33af8ea 100644 --- a/keyd.c +++ b/keyd.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -32,7 +33,7 @@ void iteratefunc(void *ctx, struct openpgp_publickey *key) struct openpgp_packet_list *list_end = NULL; struct buffer_ctx storebuf; int ret = 0; - int fd = (int) ctx; + int *fd = (int *) ctx; if (key != NULL) { storebuf.offset = 0; @@ -52,10 +53,10 @@ void iteratefunc(void *ctx, struct openpgp_publickey *key) logthing(LOGTHING_TRACE, "Sending %d bytes.", storebuf.offset); - ret = write(fd, &storebuf.offset, + ret = write(*fd, &storebuf.offset, sizeof(storebuf.offset)); if (ret != 0) { - write(fd, storebuf.buffer, + write(*fd, storebuf.buffer, storebuf.offset); } @@ -287,7 +288,7 @@ int sock_do(int fd) cmd = KEYD_REPLY_OK; write(fd, &cmd, sizeof(cmd)); config.dbbackend->iterate_keys(iteratefunc, - (void *) fd); + &fd); bytes = 0; write(fd, &bytes, sizeof(bytes)); break; @@ -310,7 +311,8 @@ int sock_do(int fd) int sock_close(int fd) { - return shutdown(fd, SHUT_RDWR); + shutdown(fd, SHUT_RDWR); + return close(fd); } int sock_accept(int fd)