mirror of
https://github.com/tmux/tmux.git
synced 2025-04-17 09:18:48 +00:00
Only close the tty during exit process and leave freeing it to when the socket is lost.
This commit is contained in:
parent
91d790411f
commit
83393d3c87
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
/* $Id: server-msg.c,v 1.40 2007-12-06 09:46:23 nicm Exp $ */
|
/* $Id: server-msg.c,v 1.41 2007-12-06 20:53:48 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -250,9 +250,8 @@ server_msg_fn_exiting(struct hdr *hdr, struct client *c)
|
|||||||
log_debug("exiting msg from client");
|
log_debug("exiting msg from client");
|
||||||
|
|
||||||
c->session = NULL;
|
c->session = NULL;
|
||||||
|
|
||||||
if (c->tty.fd != -1)
|
tty_close(&c->tty);
|
||||||
tty_free(&c->tty);
|
|
||||||
|
|
||||||
recalculate_sizes();
|
recalculate_sizes();
|
||||||
|
|
||||||
|
15
tty.c
15
tty.c
@ -1,4 +1,4 @@
|
|||||||
/* $Id: tty.c,v 1.12 2007-12-06 18:28:55 nicm Exp $ */
|
/* $Id: tty.c,v 1.13 2007-12-06 20:53:48 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -49,7 +49,10 @@ void
|
|||||||
tty_init(struct tty *tty, char *path, char *term)
|
tty_init(struct tty *tty, char *path, char *term)
|
||||||
{
|
{
|
||||||
tty->path = xstrdup(path);
|
tty->path = xstrdup(path);
|
||||||
tty->termname = xstrdup(term);
|
if (term == NULL)
|
||||||
|
tty->termname = xstrdup("unknown");
|
||||||
|
else
|
||||||
|
tty->termname = xstrdup(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -64,8 +67,6 @@ tty_open(struct tty *tty, char **cause)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tty->termname == NULL)
|
|
||||||
tty->termname = xstrdup("unknown");
|
|
||||||
if ((tty->term = tty_find_term(tty->termname, tty->fd, cause)) == NULL)
|
if ((tty->term = tty_find_term(tty->termname, tty->fd, cause)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -118,6 +119,9 @@ tty_close(struct tty *tty)
|
|||||||
{
|
{
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
|
|
||||||
|
if (tty->fd == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
if (ioctl(tty->fd, TIOCGWINSZ, &ws) == -1)
|
if (ioctl(tty->fd, TIOCGWINSZ, &ws) == -1)
|
||||||
fatal("ioctl(TIOCGWINSZ)");
|
fatal("ioctl(TIOCGWINSZ)");
|
||||||
if (tcsetattr(tty->fd, TCSANOW, &tty->tio) != 0)
|
if (tcsetattr(tty->fd, TCSANOW, &tty->tio) != 0)
|
||||||
@ -148,8 +152,7 @@ tty_close(struct tty *tty)
|
|||||||
void
|
void
|
||||||
tty_free(struct tty *tty)
|
tty_free(struct tty *tty)
|
||||||
{
|
{
|
||||||
if (tty->fd != -1)
|
tty_close(tty);
|
||||||
tty_close(tty);
|
|
||||||
|
|
||||||
if (tty->path != NULL)
|
if (tty->path != NULL)
|
||||||
xfree(tty->path);
|
xfree(tty->path);
|
||||||
|
Loading…
Reference in New Issue
Block a user