Fix the logic of the no-detached case for detach-on-destroy option - a

previous change made it so that even in the no-detached case, tmux would
always re-attach to a session, even if there weren't any detached ones.
From Martin Louazel in GitHub issue 4649.
This commit is contained in:
nicm
2025-10-20 07:28:38 +00:00
parent 21d890e6df
commit f501817154

View File

@@ -401,7 +401,7 @@ server_find_session(struct session *s,
struct session *s_loop, *s_out = NULL;
RB_FOREACH(s_loop, sessions, &sessions) {
if (s_loop != s && (s_out == NULL || f(s_loop, s_out)))
if (s_loop != s && f(s_loop, s_out))
s_out = s_loop;
}
return (s_out);
@@ -410,6 +410,8 @@ server_find_session(struct session *s,
static int
server_newer_session(struct session *s_loop, struct session *s_out)
{
if (s_out == NULL)
return (1);
return (timercmp(&s_loop->activity_time, &s_out->activity_time, >));
}