Use imsg_get_fd() instead of direct access to imsg.fd

The change in proc.c can be further simplified once imsg_free() takes
care of unclaimed file descriptors.

OK nicm@
This commit is contained in:
claudio
2024-01-16 13:09:11 +00:00
parent 40a20bc8ae
commit 2e39d698d2
2 changed files with 7 additions and 6 deletions

5
proc.c
View File

@ -92,8 +92,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;
}