Sync OpenBSD patchset 801:

Unify the way sessions are used by callbacks - store the address and use
the reference count, then check it is still on the global sessions list
in the callback.
This commit is contained in:
Tiago Cunha
2010-12-22 15:28:51 +00:00
parent b8eae3902b
commit 64d16cf2d6
5 changed files with 48 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $Id: session.c,v 1.78 2010-09-10 13:36:17 tcunha Exp $ */
/* $Id: session.c,v 1.79 2010-12-22 15:28:50 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -34,6 +34,18 @@ struct session_groups session_groups;
struct winlink *session_next_alert(struct winlink *);
struct winlink *session_previous_alert(struct winlink *);
/*
* Find if session is still alive. This is true if it is still on the global
* sessions list.
*/
int
session_alive(struct session *s)
{
u_int idx;
return (session_index(s, &idx) == 0);
}
/* Find session by name. */
struct session *
session_find(const char *name)