From 28ccaae4568fd043b505ea458f70f5960aa442cb Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 11 Aug 2009 22:34:18 +0000 Subject: Initialise log_fd to -1, prevents spurious disconnection of the client when it ends up as fd 0 (likely if the server is started with "tmux start"). Also add some extra debugging messages to server.c. --- usr.bin/tmux/server.c | 5 ++++- usr.bin/tmux/tty.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.bin/tmux') diff --git a/usr.bin/tmux/server.c b/usr.bin/tmux/server.c index c9e79389f6b..1af4027129d 100644 --- a/usr.bin/tmux/server.c +++ b/usr.bin/tmux/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.19 2009/08/11 19:32:25 nicm Exp $ */ +/* $OpenBSD: server.c,v 1.20 2009/08/11 22:34:17 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -110,6 +110,7 @@ server_create_client(int fd) } } ARRAY_ADD(&clients, c); + log_debug("new client %d", fd); } /* Find client index. */ @@ -257,6 +258,7 @@ server_main(int srv_fd) time_t now, last; siginit(); + log_debug("server socket is %d", srv_fd); last = time(NULL); @@ -901,6 +903,7 @@ server_lost_client(struct client *c) if (ARRAY_ITEM(&clients, i) == c) ARRAY_SET(&clients, i, NULL); } + log_debug("lost client %d", c->ibuf.fd); tty_free(&c->tty); diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 0c9bbe40604..a9dd2251181 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.22 2009/08/11 21:28:11 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.23 2009/08/11 22:34:17 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -49,6 +49,7 @@ tty_init(struct tty *tty, int fd, char *path, char *term) { tty->path = xstrdup(path); tty->fd = fd; + tty->log_fd = -1; if (term == NULL || *term == '\0') tty->termname = xstrdup("unknown"); -- cgit v1.2.3