diff --git a/proc.c b/proc.c index 30eedadb..68ab9604 100644 --- a/proc.c +++ b/proc.c @@ -93,8 +93,9 @@ proc_event_cb(__unused int fd, short events, void *arg) log_debug("peer %p message %d", peer, imsg.hdr.type); if (peer_check_version(peer, &imsg) != 0) { - if (imsg.fd != -1) - close(imsg.fd); + int fd = imsg_get_fd(&imsg); + if (fd != -1) + close(fd); imsg_free(&imsg); break; } diff --git a/server-client.c b/server-client.c index 79381b74..a7494503 100644 --- a/server-client.c +++ b/server-client.c @@ -2998,14 +2998,14 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg) case MSG_IDENTIFY_STDIN: if (datalen != 0) fatalx("bad MSG_IDENTIFY_STDIN size"); - c->fd = imsg->fd; - log_debug("client %p IDENTIFY_STDIN %d", c, imsg->fd); + c->fd = imsg_get_fd(imsg); + log_debug("client %p IDENTIFY_STDIN %d", c, c->fd); break; case MSG_IDENTIFY_STDOUT: if (datalen != 0) fatalx("bad MSG_IDENTIFY_STDOUT size"); - c->out_fd = imsg->fd; - log_debug("client %p IDENTIFY_STDOUT %d", c, imsg->fd); + c->out_fd = imsg_get_fd(imsg); + log_debug("client %p IDENTIFY_STDOUT %d", c, c->out_fd); break; case MSG_IDENTIFY_ENVIRON: if (datalen == 0 || data[datalen - 1] != '\0')