mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Only set default title to hostname on screens that are being used for a
window pane, no point in calling gethostname() for temporary screens.
This commit is contained in:
parent
5f122af556
commit
d9b3133321
6
screen.c
6
screen.c
@ -31,13 +31,7 @@ void screen_resize_y(struct screen *, u_int);
|
|||||||
void
|
void
|
||||||
screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit)
|
screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit)
|
||||||
{
|
{
|
||||||
char host[HOST_NAME_MAX+1];
|
|
||||||
|
|
||||||
s->grid = grid_create(sx, sy, hlimit);
|
s->grid = grid_create(sx, sy, hlimit);
|
||||||
|
|
||||||
if (gethostname(host, sizeof(host)) == 0)
|
|
||||||
s->title = xstrdup(host);
|
|
||||||
else
|
|
||||||
s->title = xstrdup("");
|
s->title = xstrdup("");
|
||||||
|
|
||||||
s->cstyle = 0;
|
s->cstyle = 0;
|
||||||
|
4
window.c
4
window.c
@ -704,6 +704,7 @@ struct window_pane *
|
|||||||
window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
||||||
{
|
{
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
|
char host[HOST_NAME_MAX + 1];
|
||||||
|
|
||||||
wp = xcalloc(1, sizeof *wp);
|
wp = xcalloc(1, sizeof *wp);
|
||||||
wp->window = w;
|
wp->window = w;
|
||||||
@ -740,6 +741,9 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
|||||||
screen_init(&wp->base, sx, sy, hlimit);
|
screen_init(&wp->base, sx, sy, hlimit);
|
||||||
wp->screen = &wp->base;
|
wp->screen = &wp->base;
|
||||||
|
|
||||||
|
if (gethostname(host, sizeof host) == 0)
|
||||||
|
screen_set_title(&wp->base, host);
|
||||||
|
|
||||||
input_init(wp);
|
input_init(wp);
|
||||||
|
|
||||||
return (wp);
|
return (wp);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user