Sync OpenBSD patchset 244:

Drop the no_stop argument to tty_close and tty_free in favour of a flag in the
tty struct.
This commit is contained in:
Tiago Cunha 2009-08-14 21:17:54 +00:00
parent b402cef338
commit 5cc971facd
4 changed files with 19 additions and 13 deletions

View File

@ -1,4 +1,4 @@
/* $Id: server-msg.c,v 1.78 2009-08-14 21:04:04 tcunha Exp $ */
/* $Id: server-msg.c,v 1.79 2009-08-14 21:17:54 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -90,7 +90,7 @@ server_msg_dispatch(struct client *c)
fatalx("bad MSG_EXITING size");
c->session = NULL;
tty_close(&c->tty, c->flags & CLIENT_SUSPENDED);
tty_close(&c->tty);
server_write_client(c, MSG_EXITED, NULL, 0);
break;
case MSG_UNLOCK:

View File

@ -1,4 +1,4 @@
/* $Id: server.c,v 1.167 2009-08-14 21:04:04 tcunha Exp $ */
/* $Id: server.c,v 1.168 2009-08-14 21:17:54 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -907,7 +907,7 @@ server_lost_client(struct client *c)
ARRAY_SET(&clients, i, NULL);
}
tty_free(&c->tty, c->flags & CLIENT_SUSPENDED);
tty_free(&c->tty);
screen_free(&c->status);

7
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.411 2009-08-14 21:13:48 tcunha Exp $ */
/* $Id: tmux.h,v 1.412 2009-08-14 21:17:54 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -866,6 +866,7 @@ struct tty {
#define TTY_FREEZE 0x2
#define TTY_ESCAPE 0x4
#define TTY_UTF8 0x8
#define TTY_STARTED 0x10
int flags;
int term_flags;
@ -1162,8 +1163,8 @@ void tty_set_title(struct tty *, const char *);
void tty_update_mode(struct tty *, int);
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int);
int tty_open(struct tty *, const char *, char **);
void tty_close(struct tty *, int);
void tty_free(struct tty *, int);
void tty_close(struct tty *);
void tty_free(struct tty *);
void tty_write(void (*)(struct tty *, struct tty_ctx *), struct tty_ctx *);
void tty_cmd_alignmenttest(struct tty *, struct tty_ctx *);
void tty_cmd_cell(struct tty *, struct tty_ctx *);

15
tty.c
View File

@ -1,4 +1,4 @@
/* $Id: tty.c,v 1.122 2009-08-09 17:28:24 tcunha Exp $ */
/* $Id: tty.c,v 1.123 2009-08-14 21:17:54 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -153,6 +153,8 @@ tty_start_tty(struct tty *tty)
tty->rupper = UINT_MAX;
tty->mode = MODE_CURSOR;
tty->flags |= TTY_STARTED;
}
void
@ -160,6 +162,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
@ -291,7 +297,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;
@ -301,7 +307,6 @@ tty_close(struct tty *tty, int no_stop)
tty->log_fd = -1;
}
if (!no_stop)
tty_stop_tty(tty);
tty_term_free(tty->term);
@ -315,9 +320,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);