mirror of
https://github.com/tmux/tmux.git
synced 2026-08-24 07:31:36 +00:00
Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master: When a pane is respawned, reset the control mode offsets. GitHub issue 5498 from Alex Rattray. Correctly clear clients referring to a session with destroy-unattached, GitHub issue 5497 from Jeong, Heon. Restore umask if bind fails, from nachalsa at naver dot com.
This commit is contained in:
21
control.c
21
control.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: control.c,v 1.65 2026/08/04 11:18:22 nicm Exp $ */
|
||||
/* $OpenBSD: control.c,v 1.66 2026/08/18 07:43:44 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -388,6 +388,25 @@ control_pause_pane(struct client *c, struct window_pane *wp)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset a pane after its buffer has been replaced: drop any output still
|
||||
* queued from the old buffer and start again from the pane's own offset.
|
||||
*/
|
||||
void
|
||||
control_reset_pane(struct client *c, struct window_pane *wp)
|
||||
{
|
||||
struct control_pane *cp;
|
||||
|
||||
if (c->control_state == NULL)
|
||||
return;
|
||||
cp = control_get_pane(c, wp);
|
||||
if (cp == NULL)
|
||||
return;
|
||||
control_discard_pane(c, cp);
|
||||
memcpy(&cp->offset, &wp->offset, sizeof cp->offset);
|
||||
memcpy(&cp->queued, &wp->offset, sizeof cp->queued);
|
||||
}
|
||||
|
||||
/* Write an already-formatted line, queueing it behind %output if needed. */
|
||||
static void
|
||||
control_write_line(struct client *c, char *line)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: server-fn.c,v 1.149 2026/07/27 14:25:46 nicm Exp $ */
|
||||
/* $OpenBSD: server-fn.c,v 1.150 2026/08/18 07:32:09 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -551,6 +551,7 @@ server_check_unattached(void)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
server_destroy_session(s);
|
||||
session_destroy(s, 1, __func__);
|
||||
}
|
||||
}
|
||||
|
||||
3
server.c
3
server.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: server.c,v 1.215 2026/08/03 10:07:57 nicm Exp $ */
|
||||
/* $OpenBSD: server.c,v 1.216 2026/08/18 07:24:49 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -129,6 +129,7 @@ server_create_socket(uint64_t flags, char **cause)
|
||||
mask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
|
||||
if (bind(fd, (struct sockaddr *)&sa, sizeof sa) == -1) {
|
||||
saved_errno = errno;
|
||||
umask(mask);
|
||||
close(fd);
|
||||
errno = saved_errno;
|
||||
goto fail;
|
||||
|
||||
18
spawn.c
18
spawn.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: spawn.c,v 1.50 2026/07/23 09:38:27 nicm Exp $ */
|
||||
/* $OpenBSD: spawn.c,v 1.51 2026/08/18 07:43:44 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -243,7 +243,7 @@ struct window_pane *
|
||||
spawn_pane(struct spawn_context *sc, char **cause)
|
||||
{
|
||||
struct cmdq_item *item = sc->item;
|
||||
struct client *c;
|
||||
struct client *c, *loop;
|
||||
struct session *s = sc->s;
|
||||
struct session *ts;
|
||||
struct window *w = sc->wl->window;
|
||||
@@ -331,6 +331,20 @@ spawn_pane(struct spawn_context *sc, char **cause)
|
||||
input_free(sc->wp0->ictx);
|
||||
sc->wp0->ictx = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* The old buffer is gone and the new one starts empty, so
|
||||
* offsets into the old buffer no longer mean anything. Reset
|
||||
* them, and drop output control clients still had queued.
|
||||
*/
|
||||
sc->wp0->offset.used = 0;
|
||||
sc->wp0->base_offset = 0;
|
||||
sc->wp0->pipe_offset.used = 0;
|
||||
TAILQ_FOREACH(loop, &clients, entry) {
|
||||
if (loop->flags & CLIENT_CONTROL)
|
||||
control_reset_pane(loop, sc->wp0);
|
||||
}
|
||||
|
||||
new_wp = sc->wp0;
|
||||
new_wp->flags &= ~(PANE_STATUSREADY|PANE_STATUSDRAWN);
|
||||
} else {
|
||||
|
||||
3
tmux.h
3
tmux.h
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: tmux.h,v 1.1425 2026/08/17 20:04:00 nicm Exp $ */
|
||||
/* $OpenBSD: tmux.h,v 1.1426 2026/08/18 07:43:44 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
@@ -4036,6 +4036,7 @@ void control_set_pane_on(struct client *, struct window_pane *);
|
||||
void control_set_pane_off(struct client *, struct window_pane *);
|
||||
void control_continue_pane(struct client *, struct window_pane *);
|
||||
void control_pause_pane(struct client *, struct window_pane *);
|
||||
void control_reset_pane(struct client *, struct window_pane *);
|
||||
void control_set_window_size(struct client *, u_int, u_int, u_int);
|
||||
int control_get_window_size(struct client *, u_int, u_int *, u_int *);
|
||||
void control_clear_window_size(struct client *, u_int);
|
||||
|
||||
Reference in New Issue
Block a user