mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
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:
parent
40a20bc8ae
commit
2e39d698d2
5
proc.c
5
proc.c
@ -92,8 +92,9 @@ proc_event_cb(__unused int fd, short events, void *arg)
|
|||||||
log_debug("peer %p message %d", peer, imsg.hdr.type);
|
log_debug("peer %p message %d", peer, imsg.hdr.type);
|
||||||
|
|
||||||
if (peer_check_version(peer, &imsg) != 0) {
|
if (peer_check_version(peer, &imsg) != 0) {
|
||||||
if (imsg.fd != -1)
|
int fd = imsg_get_fd(&imsg);
|
||||||
close(imsg.fd);
|
if (fd != -1)
|
||||||
|
close(fd);
|
||||||
imsg_free(&imsg);
|
imsg_free(&imsg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3002,14 +3002,14 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
|
|||||||
case MSG_IDENTIFY_STDIN:
|
case MSG_IDENTIFY_STDIN:
|
||||||
if (datalen != 0)
|
if (datalen != 0)
|
||||||
fatalx("bad MSG_IDENTIFY_STDIN size");
|
fatalx("bad MSG_IDENTIFY_STDIN size");
|
||||||
c->fd = imsg->fd;
|
c->fd = imsg_get_fd(imsg);
|
||||||
log_debug("client %p IDENTIFY_STDIN %d", c, imsg->fd);
|
log_debug("client %p IDENTIFY_STDIN %d", c, c->fd);
|
||||||
break;
|
break;
|
||||||
case MSG_IDENTIFY_STDOUT:
|
case MSG_IDENTIFY_STDOUT:
|
||||||
if (datalen != 0)
|
if (datalen != 0)
|
||||||
fatalx("bad MSG_IDENTIFY_STDOUT size");
|
fatalx("bad MSG_IDENTIFY_STDOUT size");
|
||||||
c->out_fd = imsg->fd;
|
c->out_fd = imsg_get_fd(imsg);
|
||||||
log_debug("client %p IDENTIFY_STDOUT %d", c, imsg->fd);
|
log_debug("client %p IDENTIFY_STDOUT %d", c, c->out_fd);
|
||||||
break;
|
break;
|
||||||
case MSG_IDENTIFY_ENVIRON:
|
case MSG_IDENTIFY_ENVIRON:
|
||||||
if (datalen == 0 || data[datalen - 1] != '\0')
|
if (datalen == 0 || data[datalen - 1] != '\0')
|
||||||
|
Loading…
Reference in New Issue
Block a user