mirror of
https://github.com/tmux/tmux.git
synced 2026-10-13 14:24:28 +00:00
Do not reuse old session group names when a new session is the same as
its original session, GitHub issue 5704.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: cmd-new-session.c,v 1.153 2026/10/09 13:12:14 nicm Exp $ */
|
/* $OpenBSD: cmd-new-session.c,v 1.154 2026/10/12 07:52:05 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -82,7 +82,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
char *cause, *cwd = NULL, *cp, *ename;
|
char *cause, *cwd = NULL, *cp, *ename;
|
||||||
char *wname = NULL, *sname = NULL, *prefix = NULL;
|
char *wname = NULL, *sname = NULL, *prefix = NULL;
|
||||||
int detached, already_attached, is_control = 0;
|
int detached, already_attached, is_control = 0;
|
||||||
u_int sx, sy, dsx, dsy, count = args_count(args);
|
u_int sx, sy, dsx, dsy, idx;
|
||||||
|
u_int count = args_count(args);
|
||||||
struct spawn_context sc = { 0 };
|
struct spawn_context sc = { 0 };
|
||||||
enum cmd_retval retval;
|
enum cmd_retval retval;
|
||||||
struct cmd_find_state fs;
|
struct cmd_find_state fs;
|
||||||
@@ -316,12 +317,17 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
* so add it to the group and synchronize.
|
* so add it to the group and synchronize.
|
||||||
*/
|
*/
|
||||||
if (group != NULL) {
|
if (group != NULL) {
|
||||||
if (sg == NULL) {
|
if (sg == NULL && groupwith == NULL)
|
||||||
if (groupwith != NULL) {
|
|
||||||
sg = session_group_new(groupwith->name);
|
|
||||||
session_group_add(sg, groupwith);
|
|
||||||
} else
|
|
||||||
sg = session_group_new(group);
|
sg = session_group_new(group);
|
||||||
|
else if (sg == NULL) {
|
||||||
|
cp = xstrdup(groupwith->name);
|
||||||
|
for (idx = 1; session_group_find(cp) != NULL; idx++) {
|
||||||
|
free(cp);
|
||||||
|
xasprintf(&cp, "%s-%u", groupwith->name, idx);
|
||||||
|
}
|
||||||
|
sg = session_group_new(cp);
|
||||||
|
free(cp);
|
||||||
|
session_group_add(sg, groupwith);
|
||||||
}
|
}
|
||||||
session_group_add(sg, s);
|
session_group_add(sg, s);
|
||||||
session_group_synchronize_to(s);
|
session_group_synchronize_to(s);
|
||||||
|
|||||||
Reference in New Issue
Block a user