summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2020-05-16 16:07:56 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2020-05-16 16:07:56 +0000
commit3e697fabd80c0f7ca6d38cd29ff1cb120993a466 (patch)
tree638de34e5cb821be9ab02b94868108cc123eb2e0 /usr.bin/tmux/tty.c
parent90963891c95c46dd2a21445906034c50d8c66f0a (diff)
Add a -D flag to ask tmux not to daemonize, useful both for running a
debugger (lldb does not have follow-fork-mode) and for running with a managed supervisor init system. GitHub issue 2190.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 277cb95661a..f9ae50a3ff4 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.374 2020/05/16 15:36:57 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.375 2020/05/16 16:07:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -154,16 +154,21 @@ tty_read_callback(__unused int fd, __unused short events, void *data)
{
struct tty *tty = data;
struct client *c = tty->client;
+ const char *name = c->name;
size_t size = EVBUFFER_LENGTH(tty->in);
int nread;
nread = evbuffer_read(tty->in, tty->fd, -1);
if (nread == 0 || nread == -1) {
+ if (nread == 0)
+ log_debug("%s: read closed", name);
+ else
+ log_debug("%s: read error: %s", name, strerror(errno));
event_del(&tty->event_in);
server_client_lost(tty->client);
return;
}
- log_debug("%s: read %d bytes (already %zu)", c->name, nread, size);
+ log_debug("%s: read %d bytes (already %zu)", name, nread, size);
while (tty_keys_next(tty))
;