1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-29 16:47:15 +00:00

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 af1b6d4dac
commit bcac80d843

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: server-fn.c,v 1.139 2025/09/09 08:49:22 nicm Exp $ */
/* $OpenBSD: server-fn.c,v 1.140 2025/10/20 07:28:38 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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, >));
}