=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/server-client.c,v retrieving revision 1.350 retrieving revision 1.351 diff -c -r1.350 -r1.351 *** src/usr.bin/tmux/server-client.c 2020/05/24 14:45:00 1.350 --- src/usr.bin/tmux/server-client.c 2020/05/26 08:41:47 1.351 *************** *** 1,4 **** ! /* $OpenBSD: server-client.c,v 1.350 2020/05/24 14:45:00 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott --- 1,4 ---- ! /* $OpenBSD: server-client.c,v 1.351 2020/05/26 08:41:47 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott *************** *** 223,229 **** c->environ = environ_create(); c->fd = -1; ! c->cwd = NULL; c->queue = cmdq_new(); RB_INIT(&c->windows); --- 223,229 ---- c->environ = environ_create(); c->fd = -1; ! c->out_fd = -1; c->queue = cmdq_new(); RB_INIT(&c->windows); *************** *** 338,343 **** --- 338,345 ---- proc_remove_peer(c->peer); c->peer = NULL; + if (c->out_fd != -1) + close(c->out_fd); if (c->fd != -1) { close(c->fd); c->fd = -1; *************** *** 1573,1582 **** out: /* * If there is data remaining, and there are no clients able to consume ! * it, do not read any more. This is true when 1) there are attached ! * clients 2) all the clients are control clients 3) all of them have ! * either the OFF flag set, or are otherwise not able to accept any ! * more data for this pane. */ if (off) bufferevent_disable(wp->event, EV_READ); --- 1575,1583 ---- out: /* * If there is data remaining, and there are no clients able to consume ! * it, do not read any more. This is true when there are attached ! * clients, all of which are control clients which are not able to ! * accept any more data. */ if (off) bufferevent_disable(wp->event, EV_READ); *************** *** 1969,1974 **** --- 1970,1976 ---- case MSG_IDENTIFY_TTYNAME: case MSG_IDENTIFY_CWD: case MSG_IDENTIFY_STDIN: + case MSG_IDENTIFY_STDOUT: case MSG_IDENTIFY_ENVIRON: case MSG_IDENTIFY_CLIENTPID: case MSG_IDENTIFY_DONE: *************** *** 2179,2184 **** --- 2181,2192 ---- c->fd = imsg->fd; log_debug("client %p IDENTIFY_STDIN %d", c, imsg->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); + break; case MSG_IDENTIFY_ENVIRON: if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_IDENTIFY_ENVIRON string"); *************** *** 2207,2217 **** c->name = name; log_debug("client %p name is %s", c, c->name); ! if (c->flags & CLIENT_CONTROL) { ! close(c->fd); ! c->fd = -1; control_start(c); ! } else if (c->fd != -1) { if (tty_init(&c->tty, c) != 0) { close(c->fd); c->fd = -1; --- 2215,2223 ---- c->name = name; log_debug("client %p name is %s", c, c->name); ! if (c->flags & CLIENT_CONTROL) control_start(c); ! else if (c->fd != -1) { if (tty_init(&c->tty, c) != 0) { close(c->fd); c->fd = -1; *************** *** 2219,2224 **** --- 2225,2232 ---- tty_resize(&c->tty); c->flags |= CLIENT_TERMINAL; } + close(c->out_fd); + c->out_fd = -1; } /* *************** *** 2335,2341 **** server_client_set_flags(struct client *c, const char *flags) { char *s, *copy, *next; ! int flag, not; s = copy = xstrdup (flags); while ((next = strsep(&s, ",")) != NULL) { --- 2343,2350 ---- server_client_set_flags(struct client *c, const char *flags) { char *s, *copy, *next; ! uint64_t flag; ! int not; s = copy = xstrdup (flags); while ((next = strsep(&s, ",")) != NULL) {