summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index fa826e57bd6..514d6140512 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.19 2009/08/08 13:29:27 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.20 2009/08/11 19:32:25 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -149,6 +149,8 @@ tty_start_tty(struct tty *tty)
tty->rupper = UINT_MAX;
tty->mode = MODE_CURSOR;
+
+ tty->flags |= TTY_STARTED;
}
void
@@ -156,6 +158,10 @@ tty_stop_tty(struct tty *tty)
{
struct winsize ws;
+ if (!(tty->flags & TTY_STARTED))
+ return;
+ tty->flags &= ~TTY_STARTED;
+
/*
* Be flexible about error handling and try not kill the server just
* because the fd is invalid. Things like ssh -t can easily leave us
@@ -281,7 +287,7 @@ tty_get_acs(struct tty *tty, u_char ch)
}
void
-tty_close(struct tty *tty, int no_stop)
+tty_close(struct tty *tty)
{
if (tty->fd == -1)
return;
@@ -291,8 +297,7 @@ tty_close(struct tty *tty, int no_stop)
tty->log_fd = -1;
}
- if (!no_stop)
- tty_stop_tty(tty);
+ tty_stop_tty(tty);
tty_term_free(tty->term);
tty_keys_free(tty);
@@ -305,9 +310,9 @@ tty_close(struct tty *tty, int no_stop)
}
void
-tty_free(struct tty *tty, int no_stop)
+tty_free(struct tty *tty)
{
- tty_close(tty, no_stop);
+ tty_close(tty);
if (tty->path != NULL)
xfree(tty->path);